LLVM  13.0.0git
AppendingTypeTableBuilder.h
Go to the documentation of this file.
1 //===- AppendingTypeTableBuilder.h -------------------------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
10 #define LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/SmallVector.h"
18 #include "llvm/Support/Allocator.h"
19 #include <cstdint>
20 
21 namespace llvm {
22 namespace codeview {
23 
25 
27 
28  BumpPtrAllocator &RecordStorage;
29  SimpleTypeSerializer SimpleSerializer;
30 
31  /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
32  SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
33 
34 public:
37 
38  // TypeCollection overrides
39  Optional<TypeIndex> getFirst() override;
40  Optional<TypeIndex> getNext(TypeIndex Prev) override;
41  CVType getType(TypeIndex Index) override;
43  bool contains(TypeIndex Index) override;
44  uint32_t size() override;
45  uint32_t capacity() override;
46  bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
47 
48  // public interface
49  void reset();
50  TypeIndex nextTypeIndex() const;
51 
52  BumpPtrAllocator &getAllocator() { return RecordStorage; }
53 
57 
58  template <typename T> TypeIndex writeLeafType(T &Record) {
59  ArrayRef<uint8_t> Data = SimpleSerializer.serialize(Record);
60  return insertRecordBytes(Data);
61  }
62 };
63 
64 } // end namespace codeview
65 } // end namespace llvm
66 
67 #endif // LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
llvm::codeview::AppendingTypeTableBuilder::~AppendingTypeTableBuilder
~AppendingTypeTableBuilder()
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::codeview::AppendingTypeTableBuilder
Definition: AppendingTypeTableBuilder.h:26
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::codeview::AppendingTypeTableBuilder::getFirst
Optional< TypeIndex > getFirst() override
Definition: AppendingTypeTableBuilder.cpp:39
Allocator.h
llvm::codeview::AppendingTypeTableBuilder::replaceType
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
Definition: AppendingTypeTableBuilder.cpp:102
llvm::Optional
Definition: APInt.h:33
llvm::codeview::AppendingTypeTableBuilder::records
ArrayRef< ArrayRef< uint8_t > > records() const
Definition: AppendingTypeTableBuilder.cpp:71
llvm::codeview::AppendingTypeTableBuilder::nextTypeIndex
TypeIndex nextTypeIndex() const
Definition: AppendingTypeTableBuilder.cpp:30
llvm::codeview::AppendingTypeTableBuilder::contains
bool contains(TypeIndex Index) override
Definition: AppendingTypeTableBuilder.cpp:60
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
SimpleTypeSerializer.h
llvm::codeview::TypeCollection
Definition: TypeCollection.h:18
llvm::codeview::AppendingTypeTableBuilder::getTypeName
StringRef getTypeName(TypeIndex Index) override
Definition: AppendingTypeTableBuilder.cpp:56
CodeView.h
llvm::codeview::ContinuationRecordBuilder
Definition: ContinuationRecordBuilder.h:33
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
ArrayRef.h
llvm::codeview::AppendingTypeTableBuilder::reset
void reset()
Definition: AppendingTypeTableBuilder.cpp:75
llvm::codeview::AppendingTypeTableBuilder::size
uint32_t size() override
Definition: AppendingTypeTableBuilder.cpp:67
llvm::codeview::AppendingTypeTableBuilder::getType
CVType getType(TypeIndex Index) override
Definition: AppendingTypeTableBuilder.cpp:52
llvm::Record
Definition: Record.h:1472
llvm::codeview::AppendingTypeTableBuilder::getAllocator
BumpPtrAllocator & getAllocator()
Definition: AppendingTypeTableBuilder.h:52
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::codeview::CVRecord< TypeLeafKind >
uint32_t
llvm::codeview::AppendingTypeTableBuilder::capacity
uint32_t capacity() override
Definition: AppendingTypeTableBuilder.cpp:69
TypeCollection.h
TypeIndex.h
llvm::codeview::AppendingTypeTableBuilder::writeLeafType
TypeIndex writeLeafType(T &Record)
Definition: AppendingTypeTableBuilder.h:58
llvm::codeview::SimpleTypeSerializer::serialize
ArrayRef< uint8_t > serialize(T &Record)
Definition: SimpleTypeSerializer.cpp:35
SmallVector.h
llvm::codeview::AppendingTypeTableBuilder::insertRecordBytes
TypeIndex insertRecordBytes(ArrayRef< uint8_t > &Record)
Definition: AppendingTypeTableBuilder.cpp:85
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:95
llvm::codeview::AppendingTypeTableBuilder::insertRecord
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
Definition: AppendingTypeTableBuilder.cpp:93
llvm::codeview::AppendingTypeTableBuilder::AppendingTypeTableBuilder
AppendingTypeTableBuilder(BumpPtrAllocator &Storage)
Definition: AppendingTypeTableBuilder.cpp:34
llvm::codeview::AppendingTypeTableBuilder::getNext
Optional< TypeIndex > getNext(TypeIndex Prev) override
Definition: AppendingTypeTableBuilder.cpp:46
llvm::codeview::SimpleTypeSerializer
Definition: SimpleTypeSerializer.h:19