llvm.org GIT mirror llvm / 47856b2
Split TypeTableBuilder into two classes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319456 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 1 year, 11 months ago
18 changed file(s) with 520 addition(s) and 352 deletion(s). Raw diff Collapse all Expand all
0 //===- AppendingTypeTableBuilder.h -------------------------------*- C++-*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
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"
14 #include "llvm/DebugInfo/CodeView/CodeView.h"
15 #include "llvm/DebugInfo/CodeView/SimpleTypeSerializer.h"
16 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
17 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
18 #include "llvm/Support/Allocator.h"
19 #include
20 #include
21 #include
22 #include
23
24 namespace llvm {
25 namespace codeview {
26
27 class ContinuationRecordBuilder;
28
29 class AppendingTypeTableBuilder : public TypeCollection {
30
31 BumpPtrAllocator &RecordStorage;
32 SimpleTypeSerializer SimpleSerializer;
33
34 /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
35 SmallVector, 2> SeenRecords;
36
37 public:
38 explicit AppendingTypeTableBuilder(BumpPtrAllocator &Storage);
39 ~AppendingTypeTableBuilder();
40
41 // TypeTableCollection overrides
42 Optional getFirst() override;
43 Optional getNext(TypeIndex Prev) override;
44 CVType getType(TypeIndex Index) override;
45 StringRef getTypeName(TypeIndex Index) override;
46 bool contains(TypeIndex Index) override;
47 uint32_t size() override;
48 uint32_t capacity() override;
49
50 // public interface
51 void reset();
52 TypeIndex nextTypeIndex() const;
53
54 BumpPtrAllocator &getAllocator() { return RecordStorage; }
55
56 ArrayRef> records() const;
57 TypeIndex insertRecordBytes(ArrayRef &Record);
58 TypeIndex insertRecord(ContinuationRecordBuilder &Builder);
59
60 template TypeIndex writeLeafType(T &Record) {
61 ArrayRef Data = SimpleSerializer.serialize(Record);
62 return insertRecordBytes(Data);
63 }
64 };
65
66 } // end namespace codeview
67 } // end namespace llvm
68
69 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
0 //===- MergingTypeTableBuilder.h ---------------------------------*- C++-*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
10 #define LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
11
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/DebugInfo/CodeView/CodeView.h"
16 #include "llvm/DebugInfo/CodeView/SimpleTypeSerializer.h"
17 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
18 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
19 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
20 #include "llvm/Support/Allocator.h"
21 #include "llvm/Support/Error.h"
22 #include
23 #include
24 #include
25 #include
26
27 namespace llvm {
28 namespace codeview {
29
30 class ContinuationRecordBuilder;
31 class TypeHasher;
32
33 class MergingTypeTableBuilder : public TypeCollection {
34
35 BumpPtrAllocator &RecordStorage;
36 SimpleTypeSerializer SimpleSerializer;
37
38 /// Private type record hashing implementation details are handled here.
39 std::unique_ptr Hasher;
40
41 /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
42 SmallVector, 2> SeenRecords;
43
44 public:
45 explicit MergingTypeTableBuilder(BumpPtrAllocator &Storage);
46 ~MergingTypeTableBuilder();
47
48 // TypeTableCollection overrides
49 Optional getFirst() override;
50 Optional getNext(TypeIndex Prev) override;
51 CVType getType(TypeIndex Index) override;
52 StringRef getTypeName(TypeIndex Index) override;
53 bool contains(TypeIndex Index) override;
54 uint32_t size() override;
55 uint32_t capacity() override;
56
57 // public interface
58 void reset();
59 TypeIndex nextTypeIndex() const;
60
61 BumpPtrAllocator &getAllocator() { return RecordStorage; }
62
63 ArrayRef> records() const;
64 TypeIndex insertRecordBytes(ArrayRef &Record);
65 TypeIndex insertRecord(ContinuationRecordBuilder &Builder);
66
67 template TypeIndex writeLeafType(T &Record) {
68 ArrayRef Data = SimpleSerializer.serialize(Record);
69 return insertRecordBytes(Data);
70 }
71 };
72
73 } // end namespace codeview
74 } // end namespace llvm
75
76 #endif // LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
1818 namespace codeview {
1919
2020 class TypeIndex;
21 class TypeTableBuilder;
21 class MergingTypeTableBuilder;
2222
2323 /// \brief Merge one set of type records into another. This method assumes
2424 /// that all records are type records, and there are no Id records present.
3333 ///
3434 /// \returns Error::success() if the operation succeeded, otherwise an
3535 /// appropriate error code.
36 Error mergeTypeRecords(TypeTableBuilder &Dest,
36 Error mergeTypeRecords(MergingTypeTableBuilder &Dest,
3737 SmallVectorImpl &SourceToDest,
3838 const CVTypeArray &Types);
3939
5858 ///
5959 /// \returns Error::success() if the operation succeeded, otherwise an
6060 /// appropriate error code.
61 Error mergeIdRecords(TypeTableBuilder &Dest, ArrayRef Types,
61 Error mergeIdRecords(MergingTypeTableBuilder &Dest, ArrayRef Types,
6262 SmallVectorImpl &SourceToDest,
6363 const CVTypeArray &Ids);
6464
7777 ///
7878 /// \returns Error::success() if the operation succeeded, otherwise an
7979 /// appropriate error code.
80 Error mergeTypeAndIdRecords(TypeTableBuilder &DestIds,
81 TypeTableBuilder &DestTypes,
80 Error mergeTypeAndIdRecords(MergingTypeTableBuilder &DestIds,
81 MergingTypeTableBuilder &DestTypes,
8282 SmallVectorImpl &SourceToDest,
8383 const CVTypeArray &IdsAndTypes);
8484
+0
-77
include/llvm/DebugInfo/CodeView/TypeTableBuilder.h less more
None //===- TypeTableBuilder.h ----------------------------------------*- C++-*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
10 #define LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
11
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/DebugInfo/CodeView/CodeView.h"
16 #include "llvm/DebugInfo/CodeView/SimpleTypeSerializer.h"
17 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
18 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
19 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
20 #include "llvm/Support/Allocator.h"
21 #include "llvm/Support/Error.h"
22 #include
23 #include
24 #include
25 #include
26
27 namespace llvm {
28 namespace codeview {
29
30 class ContinuationRecordBuilder;
31 class TypeHasher;
32
33 class TypeTableBuilder : public TypeCollection {
34
35 BumpPtrAllocator &RecordStorage;
36 SimpleTypeSerializer SimpleSerializer;
37
38 /// Private type record hashing implementation details are handled here.
39 std::unique_ptr Hasher;
40
41 /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
42 SmallVector, 2> SeenRecords;
43
44 public:
45 explicit TypeTableBuilder(BumpPtrAllocator &Storage, bool Hash = true);
46 ~TypeTableBuilder();
47
48 // TypeTableCollection overrides
49 Optional getFirst() override;
50 Optional getNext(TypeIndex Prev) override;
51 CVType getType(TypeIndex Index) override;
52 StringRef getTypeName(TypeIndex Index) override;
53 bool contains(TypeIndex Index) override;
54 uint32_t size() override;
55 uint32_t capacity() override;
56
57 // public interface
58 void reset();
59 TypeIndex nextTypeIndex() const;
60
61 BumpPtrAllocator &getAllocator() { return RecordStorage; }
62
63 ArrayRef> records() const;
64 TypeIndex insertRecordBytes(ArrayRef &Record);
65 TypeIndex insertRecord(ContinuationRecordBuilder &Builder);
66
67 template TypeIndex writeLeafType(T &Record) {
68 ArrayRef Data = SimpleSerializer.serialize(Record);
69 return insertRecordBytes(Data);
70 }
71 };
72
73 } // end namespace codeview
74 } // end namespace llvm
75
76 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
2626 namespace llvm {
2727
2828 namespace codeview {
29 class TypeTableBuilder;
29 class AppendingTypeTableBuilder;
3030 }
3131
3232 namespace CodeViewYAML {
4646 std::shared_ptr Leaf;
4747
4848 codeview::CVType
49 toCodeViewRecord(codeview::TypeTableBuilder &Serializer) const;
49 toCodeViewRecord(codeview::AppendingTypeTableBuilder &Serializer) const;
5050 static Expected fromCodeViewRecord(codeview::CVType Type);
5151 };
5252
2222 #include "llvm/ADT/SetVector.h"
2323 #include "llvm/ADT/SmallVector.h"
2424 #include "llvm/DebugInfo/CodeView/CodeView.h"
25 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
2526 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
26 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
2727 #include "llvm/IR/DebugLoc.h"
2828 #include "llvm/Support/Allocator.h"
2929 #include "llvm/Support/Compiler.h"
5151 class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
5252 MCStreamer &OS;
5353 BumpPtrAllocator Allocator;
54 codeview::TypeTableBuilder TypeTable;
54 codeview::MergingTypeTableBuilder TypeTable;
5555
5656 /// Represents the most general definition range.
5757 struct LocalVarDefRange {
0 //===- AppendingTypeTableBuilder.cpp --------------------------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h"
10 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/DenseSet.h"
12 #include "llvm/ADT/STLExtras.h"
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
15 #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
16 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
17 #include "llvm/Support/Allocator.h"
18 #include "llvm/Support/BinaryByteStream.h"
19 #include "llvm/Support/BinaryStreamWriter.h"
20 #include "llvm/Support/Endian.h"
21 #include "llvm/Support/Error.h"
22 #include
23 #include
24 #include
25 #include
26
27 using namespace llvm;
28 using namespace llvm::codeview;
29
30 TypeIndex AppendingTypeTableBuilder::nextTypeIndex() const {
31 return TypeIndex::fromArrayIndex(SeenRecords.size());
32 }
33
34 AppendingTypeTableBuilder::AppendingTypeTableBuilder(BumpPtrAllocator &Storage)
35 : RecordStorage(Storage) {}
36
37 AppendingTypeTableBuilder::~AppendingTypeTableBuilder() = default;
38
39 Optional AppendingTypeTableBuilder::getFirst() {
40 if (empty())
41 return None;
42
43 return TypeIndex(TypeIndex::FirstNonSimpleIndex);
44 }
45
46 Optional AppendingTypeTableBuilder::getNext(TypeIndex Prev) {
47 if (++Prev == nextTypeIndex())
48 return None;
49 return Prev;
50 }
51
52 CVType AppendingTypeTableBuilder::getType(TypeIndex Index) {
53 CVType Type;
54 Type.RecordData = SeenRecords[Index.toArrayIndex()];
55 const RecordPrefix *P =
56 reinterpret_cast(Type.RecordData.data());
57 Type.Type = static_cast(uint16_t(P->RecordKind));
58 return Type;
59 }
60
61 StringRef AppendingTypeTableBuilder::getTypeName(TypeIndex Index) {
62 llvm_unreachable("Method not implemented");
63 }
64
65 bool AppendingTypeTableBuilder::contains(TypeIndex Index) {
66 if (Index.isSimple() || Index.isNoneType())
67 return false;
68
69 return Index.toArrayIndex() < SeenRecords.size();
70 }
71
72 uint32_t AppendingTypeTableBuilder::size() { return SeenRecords.size(); }
73
74 uint32_t AppendingTypeTableBuilder::capacity() { return SeenRecords.size(); }
75
76 ArrayRef> AppendingTypeTableBuilder::records() const {
77 return SeenRecords;
78 }
79
80 void AppendingTypeTableBuilder::reset() { SeenRecords.clear(); }
81
82 TypeIndex
83 AppendingTypeTableBuilder::insertRecordBytes(ArrayRef &Record) {
84 TypeIndex NewTI = nextTypeIndex();
85 uint8_t *Stable = RecordStorage.Allocate(Record.size());
86 memcpy(Stable, Record.data(), Record.size());
87 Record = ArrayRef(Stable, Record.size());
88 SeenRecords.push_back(Record);
89 return NewTI;
90 }
91
92 TypeIndex
93 AppendingTypeTableBuilder::insertRecord(ContinuationRecordBuilder &Builder) {
94 TypeIndex TI;
95 auto Fragments = Builder.end(nextTypeIndex());
96 assert(!Fragments.empty());
97 for (auto C : Fragments)
98 TI = insertRecordBytes(C.RecordData);
99 return TI;
100 }
0 add_llvm_library(LLVMDebugInfoCodeView
1 AppendingTypeTableBuilder.cpp
12 CodeViewError.cpp
23 CodeViewRecordIO.cpp
34 ContinuationRecordBuilder.cpp
1920 Formatters.cpp
2021 LazyRandomTypeCollection.cpp
2122 Line.cpp
23 MergingTypeTableBuilder.cpp
2224 RecordName.cpp
2325 RecordSerialization.cpp
2426 SimpleTypeSerializer.cpp
3032 TypeIndex.cpp
3133 TypeIndexDiscovery.cpp
3234 TypeRecordMapping.cpp
33 TypeTableBuilder.cpp
3435 TypeStreamMerger.cpp
3536 TypeTableCollection.cpp
3637
0 //===- MergingTypeTableBuilder.cpp ----------------------------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
10 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/DenseSet.h"
12 #include "llvm/ADT/STLExtras.h"
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
15 #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
16 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
17 #include "llvm/Support/Allocator.h"
18 #include "llvm/Support/BinaryByteStream.h"
19 #include "llvm/Support/BinaryStreamWriter.h"
20 #include "llvm/Support/Endian.h"
21 #include "llvm/Support/Error.h"
22 #include
23 #include
24 #include
25 #include
26
27 using namespace llvm;
28 using namespace llvm::codeview;
29
30 namespace {
31
32 struct HashedType {
33 hash_code Hash;
34 ArrayRef Data;
35 TypeIndex Index;
36 };
37
38 /// Wrapper around a poitner to a HashedType. Hash and equality operations are
39 /// based on data in the pointee.
40 struct HashedTypePtr {
41 HashedTypePtr() = default;
42 HashedTypePtr(HashedType *Ptr) : Ptr(Ptr) {}
43
44 HashedType *Ptr = nullptr;
45 };
46
47 } // end anonymous namespace
48
49 namespace llvm {
50
51 template <> struct DenseMapInfo {
52 static inline HashedTypePtr getEmptyKey() { return HashedTypePtr(nullptr); }
53
54 static inline HashedTypePtr getTombstoneKey() {
55 return HashedTypePtr(reinterpret_cast(1));
56 }
57
58 static unsigned getHashValue(HashedTypePtr Val) {
59 assert(Val.Ptr != getEmptyKey().Ptr && Val.Ptr != getTombstoneKey().Ptr);
60 return Val.Ptr->Hash;
61 }
62
63 static bool isEqual(HashedTypePtr LHSP, HashedTypePtr RHSP) {
64 HashedType *LHS = LHSP.Ptr;
65 HashedType *RHS = RHSP.Ptr;
66 if (RHS == getEmptyKey().Ptr || RHS == getTombstoneKey().Ptr)
67 return LHS == RHS;
68 if (LHS->Hash != RHS->Hash)
69 return false;
70 return LHS->Data == RHS->Data;
71 }
72 };
73
74 } // end namespace llvm
75
76 /// Private implementation so that we don't leak our DenseMap instantiations to
77 /// users.
78 class llvm::codeview::TypeHasher {
79 private:
80 /// Storage for type record provided by the caller. Records will outlive the
81 /// hasher object, so they should be allocated here.
82 BumpPtrAllocator &RecordStorage;
83
84 /// Storage for hash keys. These only need to live as long as the hashing
85 /// operation.
86 BumpPtrAllocator KeyStorage;
87
88 /// Hash table. We really want a DenseMap, TypeIndex> here,
89 /// but DenseMap is inefficient when the keys are long (like type records)
90 /// because it recomputes the hash value of every key when it grows. This
91 /// value type stores the hash out of line in KeyStorage, so that table
92 /// entries are small and easy to rehash.
93 DenseSet HashedRecords;
94
95 public:
96 TypeHasher(BumpPtrAllocator &RecordStorage) : RecordStorage(RecordStorage) {}
97
98 void reset() { HashedRecords.clear(); }
99
100 /// Takes the bytes of type record, inserts them into the hash table, saves
101 /// them, and returns a pointer to an identical stable type record along with
102 /// its type index in the destination stream.
103 TypeIndex getOrCreateRecord(ArrayRef &Record, TypeIndex TI);
104 };
105
106 TypeIndex TypeHasher::getOrCreateRecord(ArrayRef &Record,
107 TypeIndex TI) {
108 assert(Record.size() < UINT32_MAX && "Record too big");
109 assert(Record.size() % 4 == 0 && "Record is not aligned to 4 bytes!");
110
111 // Compute the hash up front so we can store it in the key.
112 HashedType TempHashedType = {hash_value(Record), Record, TI};
113 auto Result = HashedRecords.insert(HashedTypePtr(&TempHashedType));
114 HashedType *&Hashed = Result.first->Ptr;
115
116 if (Result.second) {
117 // This was a new type record. We need stable storage for both the key and
118 // the record. The record should outlive the hashing operation.
119 Hashed = KeyStorage.Allocate();
120 *Hashed = TempHashedType;
121
122 uint8_t *Stable = RecordStorage.Allocate(Record.size());
123 memcpy(Stable, Record.data(), Record.size());
124 Hashed->Data = makeArrayRef(Stable, Record.size());
125 }
126
127 // Update the caller's copy of Record to point a stable copy.
128 Record = Hashed->Data;
129 return Hashed->Index;
130 }
131
132 TypeIndex MergingTypeTableBuilder::nextTypeIndex() const {
133 return TypeIndex::fromArrayIndex(SeenRecords.size());
134 }
135
136 MergingTypeTableBuilder::MergingTypeTableBuilder(BumpPtrAllocator &Storage)
137 : RecordStorage(Storage) {
138 Hasher = llvm::make_unique(Storage);
139 }
140
141 MergingTypeTableBuilder::~MergingTypeTableBuilder() = default;
142
143 Optional MergingTypeTableBuilder::getFirst() {
144 if (empty())
145 return None;
146
147 return TypeIndex(TypeIndex::FirstNonSimpleIndex);
148 }
149
150 Optional MergingTypeTableBuilder::getNext(TypeIndex Prev) {
151 if (++Prev == nextTypeIndex())
152 return None;
153 return Prev;
154 }
155
156 CVType MergingTypeTableBuilder::getType(TypeIndex Index) {
157 CVType Type;
158 Type.RecordData = SeenRecords[Index.toArrayIndex()];
159 const RecordPrefix *P =
160 reinterpret_cast(Type.RecordData.data());
161 Type.Type = static_cast(uint16_t(P->RecordKind));
162 return Type;
163 }
164
165 StringRef MergingTypeTableBuilder::getTypeName(TypeIndex Index) {
166 llvm_unreachable("Method not implemented");
167 }
168
169 bool MergingTypeTableBuilder::contains(TypeIndex Index) {
170 if (Index.isSimple() || Index.isNoneType())
171 return false;
172
173 return Index.toArrayIndex() < SeenRecords.size();
174 }
175
176 uint32_t MergingTypeTableBuilder::size() { return SeenRecords.size(); }
177
178 uint32_t MergingTypeTableBuilder::capacity() { return SeenRecords.size(); }
179
180 ArrayRef> MergingTypeTableBuilder::records() const {
181 return SeenRecords;
182 }
183
184 void MergingTypeTableBuilder::reset() {
185 Hasher->reset();
186 SeenRecords.clear();
187 }
188
189 TypeIndex
190 MergingTypeTableBuilder::insertRecordBytes(ArrayRef &Record) {
191 TypeIndex ActualTI = Hasher->getOrCreateRecord(Record, nextTypeIndex());
192 if (nextTypeIndex() == ActualTI)
193 SeenRecords.push_back(Record);
194 return ActualTI;
195 }
196
197 TypeIndex
198 MergingTypeTableBuilder::insertRecord(ContinuationRecordBuilder &Builder) {
199 TypeIndex TI;
200 auto Fragments = Builder.end(nextTypeIndex());
201 assert(!Fragments.empty());
202 for (auto C : Fragments)
203 TI = insertRecordBytes(C.RecordData);
204 return TI;
205 }
99 #include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
1010 #include "llvm/ADT/SmallString.h"
1111 #include "llvm/ADT/StringExtras.h"
12 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
1213 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
1314 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
1415 #include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h"
1516 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
16 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
1717 #include "llvm/Support/Error.h"
1818 #include "llvm/Support/ScopedPrinter.h"
1919
6363
6464 static const TypeIndex Untranslated;
6565
66 Error mergeTypesAndIds(TypeTableBuilder &DestIds, TypeTableBuilder &DestTypes,
66 Error mergeTypesAndIds(MergingTypeTableBuilder &DestIds,
67 MergingTypeTableBuilder &DestTypes,
6768 const CVTypeArray &IdsAndTypes);
68 Error mergeIdRecords(TypeTableBuilder &Dest,
69 Error mergeIdRecords(MergingTypeTableBuilder &Dest,
6970 ArrayRef TypeSourceToDest,
7071 const CVTypeArray &Ids);
71 Error mergeTypeRecords(TypeTableBuilder &Dest, const CVTypeArray &Types);
72 Error mergeTypeRecords(MergingTypeTableBuilder &Dest,
73 const CVTypeArray &Types);
7274
7375 private:
7476 Error doit(const CVTypeArray &Types);
105107
106108 TypeIndex CurIndex{TypeIndex::FirstNonSimpleIndex};
107109
108 TypeTableBuilder *DestIdStream = nullptr;
109 TypeTableBuilder *DestTypeStream = nullptr;
110 MergingTypeTableBuilder *DestIdStream = nullptr;
111 MergingTypeTableBuilder *DestTypeStream = nullptr;
110112
111113 // If we're only mapping id records, this array contains the mapping for
112114 // type records.
220222 return remapIndex(Idx, IndexMap);
221223 }
222224
223 Error TypeStreamMerger::mergeTypeRecords(TypeTableBuilder &Dest,
225 Error TypeStreamMerger::mergeTypeRecords(MergingTypeTableBuilder &Dest,
224226 const CVTypeArray &Types) {
225227 DestTypeStream = &Dest;
226228
227229 return doit(Types);
228230 }
229231
230 Error TypeStreamMerger::mergeIdRecords(TypeTableBuilder &Dest,
232 Error TypeStreamMerger::mergeIdRecords(MergingTypeTableBuilder &Dest,
231233 ArrayRef TypeSourceToDest,
232234 const CVTypeArray &Ids) {
233235 DestIdStream = &Dest;
236238 return doit(Ids);
237239 }
238240
239 Error TypeStreamMerger::mergeTypesAndIds(TypeTableBuilder &DestIds,
240 TypeTableBuilder &DestTypes,
241 Error TypeStreamMerger::mergeTypesAndIds(MergingTypeTableBuilder &DestIds,
242 MergingTypeTableBuilder &DestTypes,
241243 const CVTypeArray &IdsAndTypes) {
242244 DestIdStream = &DestIds;
243245 DestTypeStream = &DestTypes;
285287 }
286288
287289 Error TypeStreamMerger::remapType(const CVType &Type) {
288 TypeTableBuilder &Dest =
290 MergingTypeTableBuilder &Dest =
289291 isIdRecord(Type.kind()) ? *DestIdStream : *DestTypeStream;
290292
291293 RemappedType R(Type);
328330 return Success;
329331 }
330332
331 Error llvm::codeview::mergeTypeRecords(TypeTableBuilder &Dest,
333 Error llvm::codeview::mergeTypeRecords(MergingTypeTableBuilder &Dest,
332334 SmallVectorImpl &SourceToDest,
333335 const CVTypeArray &Types) {
334336 TypeStreamMerger M(SourceToDest);
335337 return M.mergeTypeRecords(Dest, Types);
336338 }
337339
338 Error llvm::codeview::mergeIdRecords(TypeTableBuilder &Dest,
340 Error llvm::codeview::mergeIdRecords(MergingTypeTableBuilder &Dest,
339341 ArrayRef TypeSourceToDest,
340342 SmallVectorImpl &SourceToDest,
341343 const CVTypeArray &Ids) {
344346 }
345347
346348 Error llvm::codeview::mergeTypeAndIdRecords(
347 TypeTableBuilder &DestIds, TypeTableBuilder &DestTypes,
349 MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes,
348350 SmallVectorImpl &SourceToDest, const CVTypeArray &IdsAndTypes) {
349351 TypeStreamMerger M(SourceToDest);
350352 return M.mergeTypesAndIds(DestIds, DestTypes, IdsAndTypes);
+0
-215
lib/DebugInfo/CodeView/TypeTableBuilder.cpp less more
None //===- TypeSerialzier.cpp -------------------------------------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
10 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/DenseSet.h"
12 #include "llvm/ADT/STLExtras.h"
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
15 #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
16 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
17 #include "llvm/Support/Allocator.h"
18 #include "llvm/Support/BinaryByteStream.h"
19 #include "llvm/Support/BinaryStreamWriter.h"
20 #include "llvm/Support/Endian.h"
21 #include "llvm/Support/Error.h"
22 #include
23 #include
24 #include
25 #include
26
27 using namespace llvm;
28 using namespace llvm::codeview;
29
30 namespace {
31
32 struct HashedType {
33 hash_code Hash;
34 ArrayRef Data;
35 TypeIndex Index;
36 };
37
38 /// Wrapper around a poitner to a HashedType. Hash and equality operations are
39 /// based on data in the pointee.
40 struct HashedTypePtr {
41 HashedTypePtr() = default;
42 HashedTypePtr(HashedType *Ptr) : Ptr(Ptr) {}
43
44 HashedType *Ptr = nullptr;
45 };
46
47 } // end anonymous namespace
48
49 namespace llvm {
50
51 template <> struct DenseMapInfo {
52 static inline HashedTypePtr getEmptyKey() { return HashedTypePtr(nullptr); }
53
54 static inline HashedTypePtr getTombstoneKey() {
55 return HashedTypePtr(reinterpret_cast(1));
56 }
57
58 static unsigned getHashValue(HashedTypePtr Val) {
59 assert(Val.Ptr != getEmptyKey().Ptr && Val.Ptr != getTombstoneKey().Ptr);
60 return Val.Ptr->Hash;
61 }
62
63 static bool isEqual(HashedTypePtr LHSP, HashedTypePtr RHSP) {
64 HashedType *LHS = LHSP.Ptr;
65 HashedType *RHS = RHSP.Ptr;
66 if (RHS == getEmptyKey().Ptr || RHS == getTombstoneKey().Ptr)
67 return LHS == RHS;
68 if (LHS->Hash != RHS->Hash)
69 return false;
70 return LHS->Data == RHS->Data;
71 }
72 };
73
74 } // end namespace llvm
75
76 /// Private implementation so that we don't leak our DenseMap instantiations to
77 /// users.
78 class llvm::codeview::TypeHasher {
79 private:
80 /// Storage for type record provided by the caller. Records will outlive the
81 /// hasher object, so they should be allocated here.
82 BumpPtrAllocator &RecordStorage;
83
84 /// Storage for hash keys. These only need to live as long as the hashing
85 /// operation.
86 BumpPtrAllocator KeyStorage;
87
88 /// Hash table. We really want a DenseMap, TypeIndex> here,
89 /// but DenseMap is inefficient when the keys are long (like type records)
90 /// because it recomputes the hash value of every key when it grows. This
91 /// value type stores the hash out of line in KeyStorage, so that table
92 /// entries are small and easy to rehash.
93 DenseSet HashedRecords;
94
95 public:
96 TypeHasher(BumpPtrAllocator &RecordStorage) : RecordStorage(RecordStorage) {}
97
98 void reset() { HashedRecords.clear(); }
99
100 /// Takes the bytes of type record, inserts them into the hash table, saves
101 /// them, and returns a pointer to an identical stable type record along with
102 /// its type index in the destination stream.
103 TypeIndex getOrCreateRecord(ArrayRef &Record, TypeIndex TI);
104 };
105
106 TypeIndex TypeHasher::getOrCreateRecord(ArrayRef &Record,
107 TypeIndex TI) {
108 assert(Record.size() < UINT32_MAX && "Record too big");
109 assert(Record.size() % 4 == 0 && "Record is not aligned to 4 bytes!");
110
111 // Compute the hash up front so we can store it in the key.
112 HashedType TempHashedType = {hash_value(Record), Record, TI};
113 auto Result = HashedRecords.insert(HashedTypePtr(&TempHashedType));
114 HashedType *&Hashed = Result.first->Ptr;
115
116 if (Result.second) {
117 // This was a new type record. We need stable storage for both the key and
118 // the record. The record should outlive the hashing operation.
119 Hashed = KeyStorage.Allocate();
120 *Hashed = TempHashedType;
121
122 uint8_t *Stable = RecordStorage.Allocate(Record.size());
123 memcpy(Stable, Record.data(), Record.size());
124 Hashed->Data = makeArrayRef(Stable, Record.size());
125 }
126
127 // Update the caller's copy of Record to point a stable copy.
128 Record = Hashed->Data;
129 return Hashed->Index;
130 }
131
132 TypeIndex TypeTableBuilder::nextTypeIndex() const {
133 return TypeIndex::fromArrayIndex(SeenRecords.size());
134 }
135
136 TypeTableBuilder::TypeTableBuilder(BumpPtrAllocator &Storage, bool Hash)
137 : RecordStorage(Storage) {
138 if (Hash)
139 Hasher = llvm::make_unique(Storage);
140 }
141
142 TypeTableBuilder::~TypeTableBuilder() = default;
143
144 Optional TypeTableBuilder::getFirst() {
145 if (empty())
146 return None;
147
148 return TypeIndex(TypeIndex::FirstNonSimpleIndex);
149 }
150
151 Optional TypeTableBuilder::getNext(TypeIndex Prev) {
152 if (++Prev == nextTypeIndex())
153 return None;
154 return Prev;
155 }
156
157 CVType TypeTableBuilder::getType(TypeIndex Index) {
158 CVType Type;
159 Type.RecordData = SeenRecords[Index.toArrayIndex()];
160 const RecordPrefix *P =
161 reinterpret_cast(Type.RecordData.data());
162 Type.Type = static_cast(uint16_t(P->RecordKind));
163 return Type;
164 }
165
166 StringRef TypeTableBuilder::getTypeName(TypeIndex Index) {
167 llvm_unreachable("Method not implemented");
168 }
169
170 bool TypeTableBuilder::contains(TypeIndex Index) {
171 if (Index.isSimple() || Index.isNoneType())
172 return false;
173
174 return Index.toArrayIndex() < SeenRecords.size();
175 }
176
177 uint32_t TypeTableBuilder::size() { return SeenRecords.size(); }
178
179 uint32_t TypeTableBuilder::capacity() { return SeenRecords.size(); }
180
181 ArrayRef> TypeTableBuilder::records() const {
182 return SeenRecords;
183 }
184
185 void TypeTableBuilder::reset() {
186 if (Hasher)
187 Hasher->reset();
188 SeenRecords.clear();
189 }
190
191 TypeIndex TypeTableBuilder::insertRecordBytes(ArrayRef &Record) {
192 if (Hasher) {
193 TypeIndex ActualTI = Hasher->getOrCreateRecord(Record, nextTypeIndex());
194 if (nextTypeIndex() == ActualTI)
195 SeenRecords.push_back(Record);
196 return ActualTI;
197 }
198
199 TypeIndex NewTI = nextTypeIndex();
200 uint8_t *Stable = RecordStorage.Allocate(Record.size());
201 memcpy(Stable, Record.data(), Record.size());
202 Record = ArrayRef(Stable, Record.size());
203 SeenRecords.push_back(Record);
204 return NewTI;
205 }
206
207 TypeIndex TypeTableBuilder::insertRecord(ContinuationRecordBuilder &Builder) {
208 TypeIndex TI;
209 auto Fragments = Builder.end(nextTypeIndex());
210 assert(!Fragments.empty());
211 for (auto C : Fragments)
212 TI = insertRecordBytes(C.RecordData);
213 return TI;
214 }
1616 #include "llvm/ADT/ArrayRef.h"
1717 #include "llvm/ADT/StringRef.h"
1818 #include "llvm/BinaryFormat/COFF.h"
19 #include "llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h"
1920 #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
2021 #include "llvm/DebugInfo/CodeView/CodeView.h"
2122 #include "llvm/DebugInfo/CodeView/CodeViewError.h"
2223 #include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
2324 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
2425 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
25 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
2626 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
2727 #include "llvm/Support/Allocator.h"
2828 #include "llvm/Support/BinaryStreamReader.h"
8282 virtual ~LeafRecordBase() = default;
8383
8484 virtual void map(yaml::IO &io) = 0;
85 virtual CVType toCodeViewRecord(TypeTableBuilder &TS) const = 0;
85 virtual CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const = 0;
8686 virtual Error fromCodeViewRecord(CVType Type) = 0;
8787 };
8888
9696 return TypeDeserializer::deserializeAs(Type, Record);
9797 }
9898
99 CVType toCodeViewRecord(TypeTableBuilder &TS) const override {
99 CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override {
100100 TS.writeLeafType(Record);
101101 return CVType(Kind, TS.records().back());
102102 }
108108 explicit LeafRecordImpl(TypeLeafKind K) : LeafRecordBase(K) {}
109109
110110 void map(yaml::IO &io) override;
111 CVType toCodeViewRecord(TypeTableBuilder &TS) const override;
111 CVType toCodeViewRecord(AppendingTypeTableBuilder &TS) const override;
112112 Error fromCodeViewRecord(CVType Type) override;
113113
114114 std::vector Members;
488488 return visitMemberRecordStream(Type.content(), V);
489489 }
490490
491 CVType
492 LeafRecordImpl::toCodeViewRecord(TypeTableBuilder &TS) const {
491 CVType LeafRecordImpl::toCodeViewRecord(
492 AppendingTypeTableBuilder &TS) const {
493493 ContinuationRecordBuilder CRB;
494494 CRB.begin(ContinuationRecordKind::FieldList);
495495 for (const auto &Member : Members) {
681681 return make_error(cv_error_code::corrupt_record);
682682 }
683683
684 CVType LeafRecord::toCodeViewRecord(TypeTableBuilder &Serializer) const {
684 CVType
685 LeafRecord::toCodeViewRecord(AppendingTypeTableBuilder &Serializer) const {
685686 return Leaf->toCodeViewRecord(Serializer);
686687 }
687688
781782
782783 ArrayRef llvm::CodeViewYAML::toDebugT(ArrayRef Leafs,
783784 BumpPtrAllocator &Alloc) {
784 TypeTableBuilder TS(Alloc, false);
785 AppendingTypeTableBuilder TS(Alloc);
785786 uint32_t Size = sizeof(uint32_t);
786787 for (const auto &Leaf : Leafs) {
787788 CVType T = Leaf.Leaf->toCodeViewRecord(TS);
3434 #include "llvm/ADT/StringExtras.h"
3535 #include "llvm/BinaryFormat/Magic.h"
3636 #include "llvm/Config/config.h"
37 #include "llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h"
3738 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
3839 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
3940 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
4041 #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
42 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
4143 #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
4244 #include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
43 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
4445 #include "llvm/DebugInfo/MSF/MSFBuilder.h"
4546 #include "llvm/DebugInfo/PDB/GenericError.h"
4647 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
726727 auto &TpiBuilder = Builder.getTpiBuilder();
727728 const auto &Tpi = YamlObj.TpiStream.getValueOr(DefaultTpiStream);
728729 TpiBuilder.setVersionHeader(Tpi.Version);
729 TypeTableBuilder TS(Allocator);
730 AppendingTypeTableBuilder TS(Allocator);
730731 for (const auto &R : Tpi.Records) {
731732 CVType Type = R.toCodeViewRecord(TS);
732733 TpiBuilder.addTypeRecord(Type.RecordData, None);
988989
989990 static void mergePdbs() {
990991 BumpPtrAllocator Allocator;
991 TypeTableBuilder MergedTpi(Allocator);
992 TypeTableBuilder MergedIpi(Allocator);
992 MergingTypeTableBuilder MergedTpi(Allocator);
993 MergingTypeTableBuilder MergedIpi(Allocator);
993994
994995 // Create a Tpi and Ipi type table with all types from all input files.
995996 for (const auto &Path : opts::merge::InputFilenames) {
3030 #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
3131 #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
3232 #include "llvm/DebugInfo/CodeView/Line.h"
33 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
3334 #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
3435 #include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
3536 #include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
3940 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
4041 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
4142 #include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
42 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
4343 #include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
4444 #include "llvm/Object/COFF.h"
4545 #include "llvm/Object/ObjectFile.h"
9595 void printCOFFResources() override;
9696 void printCOFFLoadConfig() override;
9797 void printCodeViewDebugInfo() override;
98 void mergeCodeViewTypes(llvm::codeview::TypeTableBuilder &CVIDs,
99 llvm::codeview::TypeTableBuilder &CVTypes) override;
98 void
99 mergeCodeViewTypes(llvm::codeview::MergingTypeTableBuilder &CVIDs,
100 llvm::codeview::MergingTypeTableBuilder &CVTypes) override;
100101 void printStackMap() const override;
101102 private:
102103 void printSymbol(const SymbolRef &Sym);
11931194 W.printHex(Label, getFileNameForFileOffset(FileOffset), FileOffset);
11941195 }
11951196
1196 void COFFDumper::mergeCodeViewTypes(TypeTableBuilder &CVIDs,
1197 TypeTableBuilder &CVTypes) {
1197 void COFFDumper::mergeCodeViewTypes(MergingTypeTableBuilder &CVIDs,
1198 MergingTypeTableBuilder &CVTypes) {
11981199 for (const SectionRef &S : Obj->sections()) {
11991200 StringRef SectionName;
12001201 error(S.getName(SectionName));
18021803 StackMapV2Parser(StackMapContentsArray));
18031804 }
18041805
1805 void llvm::dumpCodeViewMergedTypes(ScopedPrinter &Writer,
1806 llvm::codeview::TypeTableBuilder &IDTable,
1807 llvm::codeview::TypeTableBuilder &CVTypes) {
1806 void llvm::dumpCodeViewMergedTypes(
1807 ScopedPrinter &Writer, llvm::codeview::MergingTypeTableBuilder &IDTable,
1808 llvm::codeview::MergingTypeTableBuilder &CVTypes) {
18081809 // Flatten it first, then run our dumper on it.
18091810 SmallString<0> TypeBuf;
18101811 CVTypes.ForEachRecord([&](TypeIndex TI, const CVType &Record) {
1818 class ObjectFile;
1919 }
2020 namespace codeview {
21 class TypeTableBuilder;
21 class MergingTypeTableBuilder;
2222 }
2323
2424 class ScopedPrinter;
6666 virtual void printCOFFResources() {}
6767 virtual void printCOFFLoadConfig() { }
6868 virtual void printCodeViewDebugInfo() { }
69 virtual void mergeCodeViewTypes(llvm::codeview::TypeTableBuilder &CVIDs,
70 llvm::codeview::TypeTableBuilder &CVTypes) {}
69 virtual void
70 mergeCodeViewTypes(llvm::codeview::MergingTypeTableBuilder &CVIDs,
71 llvm::codeview::MergingTypeTableBuilder &CVTypes) {}
7172
7273 // Only implemented for MachO.
7374 virtual void printMachODataInCode() { }
101102
102103 void dumpCOFFImportFile(const object::COFFImportFile *File);
103104
104 void dumpCodeViewMergedTypes(ScopedPrinter &Writer,
105 llvm::codeview::TypeTableBuilder &IDTable,
106 llvm::codeview::TypeTableBuilder &TypeTable);
105 void dumpCodeViewMergedTypes(
106 ScopedPrinter &Writer, llvm::codeview::MergingTypeTableBuilder &IDTable,
107 llvm::codeview::MergingTypeTableBuilder &TypeTable);
107108
108109 } // namespace llvm
109110
2222 #include "Error.h"
2323 #include "ObjDumper.h"
2424 #include "WindowsResourceDumper.h"
25 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
25 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
2626 #include "llvm/Object/Archive.h"
2727 #include "llvm/Object/COFFImportFile.h"
2828 #include "llvm/Object/ELFObjectFile.h"
352352 : Allocator(), IDTable(Allocator), TypeTable(Allocator) {}
353353
354354 llvm::BumpPtrAllocator Allocator;
355 llvm::codeview::TypeTableBuilder IDTable;
356 llvm::codeview::TypeTableBuilder TypeTable;
355 llvm::codeview::MergingTypeTableBuilder IDTable;
356 llvm::codeview::MergingTypeTableBuilder TypeTable;
357357 };
358358 }
359359 static ReadObjTypeTableBuilder CVTypes;
77 //===----------------------------------------------------------------------===//
88
99 #include "llvm/ADT/SmallBitVector.h"
10 #include "llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h"
1011 #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
1112 #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
1213 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
1314 #include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
14 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
1515 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
1616 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
1717 #include "llvm/Support/Allocator.h"
9393 static void SetUpTestCase() {
9494 GlobalState = llvm::make_unique();
9595
96 TypeTableBuilder Builder(GlobalState->Allocator);
96 AppendingTypeTableBuilder Builder(GlobalState->Allocator);
9797
9898 uint32_t Offset = 0;
9999 for (int I = 0; I < 11; ++I) {
350350 }
351351
352352 TEST_F(RandomAccessVisitorTest, CrossChunkName) {
353 TypeTableBuilder Builder(GlobalState->Allocator);
353 AppendingTypeTableBuilder Builder(GlobalState->Allocator);
354354
355355 // TypeIndex 0
356356 ClassRecord Class(TypeRecordKind::Class);
88
99 #include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h"
1010
11 #include "llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h"
1112 #include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
1213 #include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
13 #include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
1414 #include "llvm/Support/Allocator.h"
1515
1616 #include "gmock/gmock.h"
2525
2626 void SetUp() override {
2727 Refs.clear();
28 TTB = make_unique<TypeTableBuilder>(Storage);
28 TTB = make_unique<AppendingTypeTableBuilder>(Storage);
2929 CRB = make_unique();
3030 Symbols.clear();
3131 }
7575 discoverTypeIndicesInSymbols();
7676 }
7777
78
79 std::unique_ptr<TypeTableBuilder> TTB;
78 std::unique_ptr<AppendingTypeTableBuilder> TTB;
8079
8180 private:
8281 uint32_t countRefs(uint32_t RecordIndex) const {