LLVM 23.0.0git
SymbolCache.cpp
Go to the documentation of this file.
2
40
41using namespace llvm;
42using namespace llvm::codeview;
43using namespace llvm::pdb;
44
45// Maps codeview::SimpleTypeKind of a built-in type to the parameters necessary
46// to instantiate a NativeBuiltinSymbol for that type.
74 // This table can be grown as necessary, but these are the only types we've
75 // needed so far.
76};
77
79 : Session(Session), Dbi(Dbi), AddressToSymbolId(IMapAllocator) {
80 // Id 0 is reserved for the invalid symbol.
81 Cache.push_back(nullptr);
82 SourceFiles.push_back(nullptr);
83
84 if (Dbi)
85 Compilands.resize(Dbi->modules().getModuleCount());
86}
87
88std::unique_ptr<IPDBEnumSymbols>
90 return createTypeEnumerator(std::vector<TypeLeafKind>{Kind});
91}
92
93std::unique_ptr<IPDBEnumSymbols>
94SymbolCache::createTypeEnumerator(std::vector<TypeLeafKind> Kinds) {
95 auto Tpi = Session.getPDBFile().getPDBTpiStream();
96 if (!Tpi) {
97 consumeError(Tpi.takeError());
98 return nullptr;
99 }
100 auto &Types = Tpi->typeCollection();
101 return std::unique_ptr<IPDBEnumSymbols>(
102 new NativeEnumTypes(Session, Types, std::move(Kinds)));
103}
104
105std::unique_ptr<IPDBEnumSymbols>
107 return std::unique_ptr<IPDBEnumSymbols>(
108 new NativeEnumGlobals(Session, {Kind}));
109}
110
111SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
112 ModifierOptions Mods) const {
113 if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct)
115
116 const auto Kind = Index.getSimpleKind();
117 const auto It =
118 llvm::find_if(BuiltinTypes, [Kind](const BuiltinTypeEntry &Builtin) {
119 return Builtin.Kind == Kind;
120 });
121 if (It == std::end(BuiltinTypes))
122 return 0;
123 return createSymbol<NativeTypeBuiltin>(Mods, It->Type, It->Size);
124}
125
127SymbolCache::createSymbolForModifiedType(codeview::TypeIndex ModifierTI,
128 codeview::CVType CVT) const {
131 consumeError(std::move(EC));
132 return 0;
133 }
134
135 if (Record.ModifiedType.isSimple())
136 return createSimpleType(Record.ModifiedType, Record.Modifiers);
137
138 // Make sure we create and cache a record for the unmodified type.
139 SymIndexId UnmodifiedId = findSymbolByTypeIndex(Record.ModifiedType);
140 NativeRawSymbol &UnmodifiedNRS = *Cache[UnmodifiedId];
141
142 switch (UnmodifiedNRS.getSymTag()) {
145 static_cast<NativeTypeEnum &>(UnmodifiedNRS), std::move(Record));
146 case PDB_SymType::UDT:
148 static_cast<NativeTypeUDT &>(UnmodifiedNRS), std::move(Record));
149 default:
150 // No other types can be modified. (LF_POINTER, for example, records
151 // its modifiers a different way.
152 assert(false && "Invalid LF_MODIFIER record");
153 break;
154 }
155 return 0;
156}
157
159 // First see if it's already in our cache.
160 const auto Entry = TypeIndexToSymbolId.find(Index);
161 if (Entry != TypeIndexToSymbolId.end())
162 return Entry->second;
163
164 // Symbols for built-in types are created on the fly.
165 if (Index.isSimple()) {
166 SymIndexId Result = createSimpleType(Index, ModifierOptions::None);
167 assert(TypeIndexToSymbolId.count(Index) == 0);
168 TypeIndexToSymbolId[Index] = Result;
169 return Result;
170 }
171
172 // We need to instantiate and cache the desired type symbol.
173 auto Tpi = Session.getPDBFile().getPDBTpiStream();
174 if (!Tpi) {
175 consumeError(Tpi.takeError());
176 return 0;
177 }
178 codeview::LazyRandomTypeCollection &Types = Tpi->typeCollection();
179 codeview::CVType CVT = Types.getType(Index);
180
181 if (isUdtForwardRef(CVT)) {
182 Expected<TypeIndex> EFD = Tpi->findFullDeclForForwardRef(Index);
183
184 if (!EFD)
185 consumeError(EFD.takeError());
186 else if (*EFD != Index) {
187 assert(!isUdtForwardRef(Types.getType(*EFD)));
188 SymIndexId Result = findSymbolByTypeIndex(*EFD);
189 // Record a mapping from ForwardRef -> SymIndex of complete type so that
190 // we'll take the fast path next time.
191 assert(TypeIndexToSymbolId.count(Index) == 0);
192 TypeIndexToSymbolId[Index] = Result;
193 return Result;
194 }
195 }
196
197 // At this point if we still have a forward ref udt it means the full decl was
198 // not in the PDB. We just have to deal with it and use the forward ref.
199 SymIndexId Id = 0;
200 switch (CVT.kind()) {
201 case codeview::LF_ENUM:
202 Id = createSymbolForType<NativeTypeEnum, EnumRecord>(Index, std::move(CVT));
203 break;
204 case codeview::LF_ARRAY:
205 Id = createSymbolForType<NativeTypeArray, ArrayRecord>(Index,
206 std::move(CVT));
207 break;
208 case codeview::LF_CLASS:
209 case codeview::LF_STRUCTURE:
210 case codeview::LF_INTERFACE:
211 Id = createSymbolForType<NativeTypeUDT, ClassRecord>(Index, std::move(CVT));
212 break;
213 case codeview::LF_UNION:
214 Id = createSymbolForType<NativeTypeUDT, UnionRecord>(Index, std::move(CVT));
215 break;
216 case codeview::LF_POINTER:
217 Id = createSymbolForType<NativeTypePointer, PointerRecord>(Index,
218 std::move(CVT));
219 break;
220 case codeview::LF_MODIFIER:
221 Id = createSymbolForModifiedType(Index, std::move(CVT));
222 break;
223 case codeview::LF_PROCEDURE:
224 Id = createSymbolForType<NativeTypeFunctionSig, ProcedureRecord>(
225 Index, std::move(CVT));
226 break;
227 case codeview::LF_MFUNCTION:
228 Id = createSymbolForType<NativeTypeFunctionSig, MemberFunctionRecord>(
229 Index, std::move(CVT));
230 break;
231 case codeview::LF_VTSHAPE:
232 Id = createSymbolForType<NativeTypeVTShape, VFTableShapeRecord>(
233 Index, std::move(CVT));
234 break;
235 default:
236 Id = createSymbolPlaceholder();
237 break;
238 }
239 if (Id != 0) {
240 assert(TypeIndexToSymbolId.count(Index) == 0);
241 TypeIndexToSymbolId[Index] = Id;
242 }
243 return Id;
244}
245
246std::unique_ptr<PDBSymbol>
248 assert(SymbolId < Cache.size());
249
250 // Id 0 is reserved.
251 if (SymbolId == 0 || SymbolId >= Cache.size())
252 return nullptr;
253
254 // Make sure to handle the case where we've inserted a placeholder symbol
255 // for types we don't yet support.
256 NativeRawSymbol *NRS = Cache[SymbolId].get();
257 if (!NRS)
258 return nullptr;
259
260 return PDBSymbol::create(Session, *NRS);
261}
262
264 return *Cache[SymbolId];
265}
266
268 if (!Dbi)
269 return 0;
270
271 return Dbi->modules().getModuleCount();
272}
273
275 auto Iter = GlobalOffsetToSymbolId.find(Offset);
276 if (Iter != GlobalOffsetToSymbolId.end())
277 return Iter->second;
278
279 SymbolStream &SS = cantFail(Session.getPDBFile().getPDBSymbolStream());
280 CVSymbol CVS = SS.readRecord(Offset);
281 SymIndexId Id = 0;
282 switch (CVS.kind()) {
283 case SymbolKind::S_UDT: {
285 Id = createSymbol<NativeTypeTypedef>(std::move(US));
286 break;
287 }
288 default:
289 Id = createSymbolPlaceholder();
290 break;
291 }
292 if (Id != 0) {
293 assert(GlobalOffsetToSymbolId.count(Offset) == 0);
294 GlobalOffsetToSymbolId[Offset] = Id;
295 }
296
297 return Id;
298}
299
301 uint64_t ParentAddr,
302 uint16_t Modi,
303 uint32_t RecordOffset) const {
304 auto Iter = SymTabOffsetToSymbolId.find({Modi, RecordOffset});
305 if (Iter != SymTabOffsetToSymbolId.end())
306 return Iter->second;
307
309 SymTabOffsetToSymbolId.insert({{Modi, RecordOffset}, Id});
310 return Id;
311}
312
313std::unique_ptr<PDBSymbol> SymbolCache::findSymbolByVA(uint64_t VA,
315 switch (Type) {
317 return findFunctionSymbolByVA(VA);
319 uint32_t Sect, Offset;
320 Session.addressForVA(VA, Sect, Offset);
321 return findPublicSymbolBySectOffset(Sect, Offset);
322 }
324 uint16_t Modi;
325 if (!Session.moduleIndexForVA(VA, Modi))
326 return nullptr;
327 return getOrCreateCompiland(Modi);
328 }
329 case PDB_SymType::None: {
330 // FIXME: Implement for PDB_SymType::Data. The symbolizer calls this but
331 // only uses it to find the symbol length.
332 if (auto Sym = findFunctionSymbolByVA(VA))
333 return Sym;
334 return nullptr;
335 }
336 default:
337 return nullptr;
338 }
339}
340
341std::unique_ptr<PDBSymbol> SymbolCache::findFunctionSymbolByVA(uint64_t VA) {
342 if (!Dbi)
343 return nullptr;
344
345 auto findIdInCache = [this](uint64_t VA) -> SymIndexId {
346 auto Iter = AddressToSymbolId.find(VA);
347 if (Iter.valid() && !IMapTy::KeyTraits::startLess(VA, Iter.start()))
348 return *Iter;
349 return 0;
350 };
351
352 if (SymIndexId Id = findIdInCache(VA))
353 return getSymbolById(Id);
354
355 uint16_t Modi;
356 if (!Session.moduleIndexForVA(VA, Modi))
357 return nullptr;
358
359 // Module has already been decoded and no cached symbols found.
360 if (!FuncSymCachedModIndexes.insert(Modi).second)
361 return nullptr;
362
363 Expected<ModuleDebugStreamRef> ExpectedModS =
364 Session.getModuleDebugStream(Modi);
365 if (!ExpectedModS) {
366 consumeError(ExpectedModS.takeError());
367 return nullptr;
368 }
369
370 // Return empty intervals in AddressToSymbolId from Start to Stop.
371 auto getInsertRanges = [this](uint64_t Start, uint64_t Stop) {
373 auto Iter = AddressToSymbolId.find(Start);
374 while (Iter.valid() && IMapTy::KeyTraits::nonEmpty(Start, Stop)) {
375 if (IMapTy::KeyTraits::startLess(Start, Iter.start()))
376 Ranges.push_back({Start, std::min(Iter.start(), Stop)});
377
378 // Same result as Start = std::min(Stop, Iter.stop()).
379 Start = Iter.stop();
380 ++Iter;
381 }
382 if (IMapTy::KeyTraits::nonEmpty(Start, Stop))
383 Ranges.push_back({Start, Stop});
384
385 return Ranges;
386 };
387
388 // Decode symbols in this module.
389 CVSymbolArray Syms = ExpectedModS->getSymbolArray();
390 for (auto I = Syms.begin(), E = Syms.end(); I != E; ++I) {
391 if (I->kind() != S_LPROC32 && I->kind() != S_GPROC32)
392 continue;
393
395 uint64_t SymStart = Session.getVAFromSectOffset(PS.Segment, PS.CodeOffset);
396 uint64_t SymStop = SymStart + PS.CodeSize;
397 if (LLVM_UNLIKELY(!IMapTy::KeyTraits::nonEmpty(SymStart, SymStop))) {
398 I = Syms.at(PS.End);
399 continue;
400 }
401#ifndef NDEBUG
402 Session.checkSymbolRange(SymStart, SymStop);
403#endif
404 // Only care about range that is in this module.
405 uint16_t SymModi;
406 if (!Session.moduleIndexForVA(SymStart, SymModi) || SymModi != Modi)
407 continue;
408
409 auto Ranges = getInsertRanges(SymStart, SymStop);
410 if (!Ranges.empty()) {
412 for (auto [Start, Stop] : Ranges)
413 AddressToSymbolId.insert(Start, Stop, Id);
414 }
415
416 // Jump to the end of this ProcSym.
417 I = Syms.at(PS.End);
418 }
419
420 if (SymIndexId Id = findIdInCache(VA))
421 return getSymbolById(Id);
422
423 return nullptr;
424}
425
426std::unique_ptr<PDBSymbol>
427SymbolCache::findPublicSymbolBySectOffset(uint32_t Sect, uint32_t Offset) {
428 auto Iter = AddressToPublicSymId.find({Sect, Offset});
429 if (Iter != AddressToPublicSymId.end())
430 return getSymbolById(Iter->second);
431
432 auto Publics = Session.getPDBFile().getPDBPublicsStream();
433 if (!Publics) {
434 consumeError(Publics.takeError());
435 return nullptr;
436 }
437
438 auto ExpectedSyms = Session.getPDBFile().getPDBSymbolStream();
439 if (!ExpectedSyms) {
440 consumeError(ExpectedSyms.takeError());
441 return nullptr;
442 }
443 BinaryStreamRef SymStream =
444 ExpectedSyms->getSymbolArray().getUnderlyingStream();
445
446 // Use binary search to find the first public symbol with an address greater
447 // than or equal to Sect, Offset.
448 auto AddrMap = Publics->getAddressMap();
449 auto First = AddrMap.begin();
450 auto It = AddrMap.begin();
451 size_t Count = AddrMap.size();
452 size_t Half;
453 while (Count > 0) {
454 It = First;
455 Half = Count / 2;
456 It += Half;
457 Expected<CVSymbol> Sym = readSymbolFromStream(SymStream, *It);
458 if (!Sym) {
459 consumeError(Sym.takeError());
460 return nullptr;
461 }
462
463 auto PS =
465 if (PS.Segment < Sect || (PS.Segment == Sect && PS.Offset <= Offset)) {
466 First = ++It;
467 Count -= Half + 1;
468 } else
469 Count = Half;
470 }
471 if (It == AddrMap.begin())
472 return nullptr;
473 --It;
474
475 Expected<CVSymbol> Sym = readSymbolFromStream(SymStream, *It);
476 if (!Sym) {
477 consumeError(Sym.takeError());
478 return nullptr;
479 }
480
481 // Check if the symbol is already cached.
483 auto Found = AddressToPublicSymId.find({PS.Segment, PS.Offset});
484 if (Found != AddressToPublicSymId.end())
485 return getSymbolById(Found->second);
486
487 // Otherwise, create a new symbol.
489 AddressToPublicSymId.insert({{PS.Segment, PS.Offset}, Id});
490 return getSymbolById(Id);
491}
492
493std::vector<SymbolCache::LineTableEntry>
494SymbolCache::findLineTable(uint16_t Modi) const {
495 // Check if this module has already been added.
496 auto [LineTableIter, Inserted] = LineTable.try_emplace(Modi);
497 if (!Inserted)
498 return LineTableIter->second;
499
500 std::vector<LineTableEntry> &ModuleLineTable = LineTableIter->second;
501
502 // If there is an error or there are no lines, just return the
503 // empty vector.
504 Expected<ModuleDebugStreamRef> ExpectedModS =
505 Session.getModuleDebugStream(Modi);
506 if (!ExpectedModS) {
507 consumeError(ExpectedModS.takeError());
508 return ModuleLineTable;
509 }
510
511 std::vector<std::vector<LineTableEntry>> EntryList;
512 for (const auto &SS : ExpectedModS->getSubsectionsArray()) {
513 if (SS.kind() != DebugSubsectionKind::Lines)
514 continue;
515
516 DebugLinesSubsectionRef Lines;
517 BinaryStreamReader Reader(SS.getRecordData());
518 if (auto EC = Lines.initialize(Reader)) {
519 consumeError(std::move(EC));
520 continue;
521 }
522
523 uint32_t RelocSegment = Lines.header()->RelocSegment;
524 uint32_t RelocOffset = Lines.header()->RelocOffset;
525 for (const LineColumnEntry &Group : Lines) {
526 if (Group.LineNumbers.empty())
527 continue;
528
529 std::vector<LineTableEntry> Entries;
530
531 // If there are column numbers, then they should be in a parallel stream
532 // to the line numbers.
533 auto ColIt = Group.Columns.begin();
534 auto ColsEnd = Group.Columns.end();
535
536 // Add a line to mark the beginning of this section.
537 uint64_t StartAddr =
538 Session.getVAFromSectOffset(RelocSegment, RelocOffset);
539 LineInfo FirstLine(Group.LineNumbers.front().Flags);
540 uint32_t ColNum =
541 (Lines.hasColumnInfo()) ? Group.Columns.front().StartColumn : 0;
542 Entries.push_back({StartAddr, FirstLine, ColNum, Group.NameIndex, false});
543
544 for (const LineNumberEntry &LN : Group.LineNumbers) {
545 uint64_t VA =
546 Session.getVAFromSectOffset(RelocSegment, RelocOffset + LN.Offset);
547 LineInfo Line(LN.Flags);
548 ColNum = 0;
549
550 if (Lines.hasColumnInfo() && ColIt != ColsEnd) {
551 ColNum = ColIt->StartColumn;
552 ++ColIt;
553 }
554 Entries.push_back({VA, Line, ColNum, Group.NameIndex, false});
555 }
556
557 // Add a terminal entry line to mark the end of this subsection.
558 uint64_t EndAddr = StartAddr + Lines.header()->CodeSize;
559 LineInfo LastLine(Group.LineNumbers.back().Flags);
560 ColNum = (Lines.hasColumnInfo()) ? Group.Columns.back().StartColumn : 0;
561 Entries.push_back({EndAddr, LastLine, ColNum, Group.NameIndex, true});
562
563 EntryList.push_back(Entries);
564 }
565 }
566
567 // Sort EntryList, and add flattened contents to the line table.
568 llvm::sort(EntryList, [](const std::vector<LineTableEntry> &LHS,
569 const std::vector<LineTableEntry> &RHS) {
570 return LHS[0].Addr < RHS[0].Addr;
571 });
572 for (std::vector<LineTableEntry> &I : EntryList)
573 llvm::append_range(ModuleLineTable, I);
574
575 return ModuleLineTable;
576}
577
578std::unique_ptr<IPDBEnumLineNumbers>
580 uint16_t Modi;
581 if (!Session.moduleIndexForVA(VA, Modi))
582 return nullptr;
583
584 std::vector<LineTableEntry> Lines = findLineTable(Modi);
585 if (Lines.empty())
586 return nullptr;
587
588 // Find the first line in the line table whose address is not greater than
589 // the one we are searching for.
590 auto LineIter = llvm::partition_point(Lines, [&](const LineTableEntry &E) {
591 return (E.Addr < VA || (E.Addr == VA && E.IsTerminalEntry));
592 });
593
594 // Try to back up if we've gone too far.
595 if (LineIter == Lines.end() || LineIter->Addr > VA) {
596 if (LineIter == Lines.begin() || std::prev(LineIter)->IsTerminalEntry)
597 return nullptr;
598 --LineIter;
599 }
600
601 Expected<ModuleDebugStreamRef> ExpectedModS =
602 Session.getModuleDebugStream(Modi);
603 if (!ExpectedModS) {
604 consumeError(ExpectedModS.takeError());
605 return nullptr;
606 }
607 Expected<DebugChecksumsSubsectionRef> ExpectedChecksums =
608 ExpectedModS->findChecksumsSubsection();
609 if (!ExpectedChecksums) {
610 consumeError(ExpectedChecksums.takeError());
611 return nullptr;
612 }
613
614 // Populate a vector of NativeLineNumbers that have addresses in the given
615 // address range.
616 std::vector<NativeLineNumber> LineNumbers;
617 while (LineIter != Lines.end()) {
618 if (LineIter->IsTerminalEntry) {
619 ++LineIter;
620 continue;
621 }
622
623 // If the line is still within the address range, create a NativeLineNumber
624 // and add to the list.
625 if (LineIter->Addr > VA + Length)
626 break;
627
628 uint32_t LineSect, LineOff;
629 Session.addressForVA(LineIter->Addr, LineSect, LineOff);
630 uint32_t LineLength = std::next(LineIter)->Addr - LineIter->Addr;
631 auto ChecksumIter =
632 ExpectedChecksums->getArray().at(LineIter->FileNameIndex);
633 uint32_t SrcFileId = getOrCreateSourceFile(*ChecksumIter);
634 NativeLineNumber LineNum(Session, LineIter->Line, LineIter->ColumnNumber,
635 LineSect, LineOff, LineLength, SrcFileId, Modi);
636 LineNumbers.push_back(LineNum);
637 ++LineIter;
638 }
639 return std::make_unique<NativeEnumLineNumbers>(std::move(LineNumbers));
640}
641
642std::unique_ptr<PDBSymbolCompiland>
644 if (!Dbi)
645 return nullptr;
646
647 if (Index >= Compilands.size())
648 return nullptr;
649
650 if (Compilands[Index] == 0) {
651 const DbiModuleList &Modules = Dbi->modules();
652 Compilands[Index] =
654 }
655
656 return Session.getConcreteSymbolById<PDBSymbolCompiland>(Compilands[Index]);
657}
658
659std::unique_ptr<IPDBSourceFile>
661 assert(FileId < SourceFiles.size());
662
663 // Id 0 is reserved.
664 if (FileId == 0)
665 return nullptr;
666
667 return std::make_unique<NativeSourceFile>(*SourceFiles[FileId].get());
668}
669
672 auto [Iter, Inserted] =
673 FileNameOffsetToId.try_emplace(Checksums.FileNameOffset);
674 if (!Inserted)
675 return Iter->second;
676
677 SymIndexId Id = SourceFiles.size();
678 auto SrcFile = std::make_unique<NativeSourceFile>(Session, Id, Checksums);
679 SourceFiles.push_back(std::move(SrcFile));
680 Iter->second = Id;
681 return Id;
682}
683
684
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_UNLIKELY(EXPR)
Definition Compiler.h:336
#define I(x, y, z)
Definition MD5.cpp:57
static const struct BuiltinTypeEntry BuiltinTypes[]
Value * RHS
Value * LHS
Tagged union holding either a T or a Error.
Definition Error.h:485
Error takeError()
Take ownership of the stored error.
Definition Error.h:612
reference get()
Returns a reference to the stored T value.
Definition Error.h:582
const_iterator find(KeyT x) const
find - Return an iterator pointing to the first interval ending at or after x, or end().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Iterator at(uint32_t Offset) const
given an offset into the array's underlying stream, return an iterator to the record at that offset.
Iterator begin(bool *HadError=nullptr) const
Provides amortized O(1) random access to a CodeView type stream.
static Error deserializeAs(CVSymbol Symbol, T &Record)
static Error deserializeAs(CVType &CVT, T &Record)
A 32-bit type reference.
Definition TypeIndex.h:97
std::pair< iterator, bool > insert(const ValueT &V)
Definition DenseSet.h:202
LLVM_ABI DbiModuleDescriptor getModuleDescriptor(uint32_t Modi) const
PDB_SymType getSymTag() const override
Expected< ModuleDebugStreamRef > getModuleDebugStream(uint32_t Index) const
bool moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const
static std::unique_ptr< PDBSymbol > create(const IPDBSession &PDBSession, std::unique_ptr< IPDBRawSymbol > RawSymbol)
LLVM_ABI std::unique_ptr< IPDBEnumSymbols > createGlobalsEnumerator(codeview::SymbolKind Kind)
LLVM_ABI SymIndexId getOrCreateInlineSymbol(codeview::InlineSiteSym Sym, uint64_t ParentAddr, uint16_t Modi, uint32_t RecordOffset) const
LLVM_ABI std::unique_ptr< IPDBEnumSymbols > createTypeEnumerator(codeview::TypeLeafKind Kind)
LLVM_ABI std::unique_ptr< PDBSymbol > findSymbolByVA(uint64_t VA, PDB_SymType Type)
LLVM_ABI std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const
LLVM_ABI SymbolCache(NativeSession &Session, DbiStream *Dbi)
LLVM_ABI SymIndexId getOrCreateSourceFile(const codeview::FileChecksumEntry &Checksum) const
LLVM_ABI SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI) const
LLVM_ABI NativeRawSymbol & getNativeSymbolById(SymIndexId SymbolId) const
LLVM_ABI std::unique_ptr< PDBSymbolCompiland > getOrCreateCompiland(uint32_t Index)
LLVM_ABI uint32_t getNumCompilands() const
LLVM_ABI std::unique_ptr< IPDBSourceFile > getSourceFileById(SymIndexId FileId) const
LLVM_ABI std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByVA(uint64_t VA, uint32_t Length) const
SymIndexId createSymbol(Args &&...ConstructorArgs) const
LLVM_ABI SymIndexId getOrCreateGlobalSymbolByOffset(uint32_t Offset)
LLVM_ABI bool isUdtForwardRef(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE,...
CVRecord< TypeLeafKind > CVType
Definition CVRecord.h:64
VarStreamArray< CVSymbol > CVSymbolArray
Definition CVRecord.h:126
CVRecord< SymbolKind > CVSymbol
Definition CVRecord.h:65
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
Definition CodeView.h:34
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
Definition CodeView.h:48
ModifierOptions
Equivalent to CV_modifier_t.
Definition CodeView.h:283
LLVM_ABI Expected< CVSymbol > readSymbolFromStream(BinaryStreamRef Stream, uint32_t Offset)
uint32_t SymIndexId
Definition PDBTypes.h:26
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn....
Definition PDBTypes.h:335
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....
Definition PDBTypes.h:243
This is an optimization pass for GlobalISel generic memory operations.
@ Length
Definition DWP.cpp:532
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
Definition STLExtras.h:2129
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2208
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1636
FunctionAddr VTableAddr Count
Definition InstrProf.h:139
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
Definition ModRef.h:74
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition Error.h:769
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1772
void consumeError(Error Err)
Consume a Error without doing anything.
Definition Error.h:1106
codeview::SimpleTypeKind Kind
PDB_BuiltinType Type