39#define DEBUG_TYPE "CodeViewUtilities"
80 auto GetName = [&](
auto Record) {
89 if (RK == TypeRecordKind::Class || RK == TypeRecordKind::Class2 ||
90 RK == TypeRecordKind::Struct || RK == TypeRecordKind::Struct2)
92 else if (RK == TypeRecordKind::Union || RK == TypeRecordKind::Union2)
94 else if (RK == TypeRecordKind::Enum)
104#define DEBUG_TYPE "CodeViewDataVisitor"
118 using RecordEntry = std::pair<TypeLeafKind, LVElement *>;
119 using RecordTable = std::map<TypeIndex, RecordEntry>;
120 RecordTable RecordFromTypes;
121 RecordTable RecordFromIds;
123 using NameTable = std::map<StringRef, TypeIndex>;
124 NameTable NameFromTypes;
125 NameTable NameFromIds;
128 LVTypeRecords(
LVShared *Shared) : Shared(Shared) {}
137class LVForwardReferences {
139 using ForwardEntry = std::pair<TypeIndex, TypeIndex>;
140 using ForwardTypeNames = std::map<StringRef, ForwardEntry>;
141 ForwardTypeNames ForwardTypesNames;
144 using ForwardType = std::map<TypeIndex, TypeIndex>;
145 ForwardType ForwardTypes;
149 ForwardTypes.emplace(TIForward, TIReference);
157 It->second.first = TIForward;
158 add(TIForward, It->second.second);
168 It->second.second = TIReference;
169 add(It->second.first, TIReference);
174 LVForwardReferences() =
default;
180 (IsForwardRef) ? add(
Name, TI) : update(
Name, TI);
184 auto It = ForwardTypes.find(TIForward);
189 auto It = ForwardTypesNames.find(
Name);
190 return It != ForwardTypesNames.end() ? It->second.second
203class LVNamespaceDeduction {
206 using Names = std::map<StringRef, LVScope *>;
207 Names NamespaceNames;
209 using LookupSet = std::set<StringRef>;
210 LookupSet DeducedScopes;
211 LookupSet UnresolvedScopes;
212 LookupSet IdentifiedNamespaces;
215 if (NamespaceNames.find(
Name) == NamespaceNames.end())
216 NamespaceNames.emplace(
Name, Namespace);
220 LVNamespaceDeduction(
LVShared *Shared) : Shared(Shared) {}
229 auto It = NamespaceNames.find(
Name);
230 LVScope *Namespace = It != NamespaceNames.end() ? It->second :
nullptr;
238 if (Components.empty())
241 LVStringRefs::size_type FirstNamespace = 0;
242 LVStringRefs::size_type FirstNonNamespace;
243 for (LVStringRefs::size_type Index = 0; Index < Components.size();
245 FirstNonNamespace = Index;
246 LookupSet::iterator Iter = IdentifiedNamespaces.find(Components[Index]);
247 if (Iter == IdentifiedNamespaces.end())
251 return std::make_tuple(FirstNamespace, FirstNonNamespace);
256class LVStringRecords {
257 using StringEntry = std::tuple<uint32_t, std::string, LVScopeCompileUnit *>;
258 using StringIds = std::map<TypeIndex, StringEntry>;
262 LVStringRecords() =
default;
266 auto [It,
Inserted] = Strings.try_emplace(TI);
268 It->second = std::make_tuple(++Index, std::string(
String),
nullptr);
272 StringIds::iterator Iter = Strings.
find(TI);
273 return Iter != Strings.end() ? std::get<1>(Iter->second) :
StringRef{};
277 StringIds::iterator Iter = Strings.find(TI);
278 return Iter != Strings.end() ? std::get<0>(Iter->second) : 0;
321 (StreamIdx ==
StreamTPI) ? RecordFromTypes : RecordFromIds;
322 Target.emplace(std::piecewise_construct, std::forward_as_tuple(TI),
323 std::forward_as_tuple(
Kind, Element));
326void LVTypeRecords::add(uint32_t StreamIdx, TypeIndex TI, StringRef
Name) {
327 NameTable &
Target = (StreamIdx ==
StreamTPI) ? NameFromTypes : NameFromIds;
331LVElement *LVTypeRecords::find(uint32_t StreamIdx, TypeIndex TI,
bool Create) {
333 (StreamIdx ==
StreamTPI) ? RecordFromTypes : RecordFromIds;
335 LVElement *Element =
nullptr;
336 RecordTable::iterator Iter =
Target.find(TI);
337 if (Iter !=
Target.end()) {
338 Element = Iter->second.second;
339 if (Element || !Create)
346 Element->setOffsetFromTypeIndex();
347 Target[TI].second = Element;
353TypeIndex LVTypeRecords::find(uint32_t StreamIdx, StringRef
Name) {
354 NameTable &
Target = (StreamIdx ==
StreamTPI) ? NameFromTypes : NameFromIds;
359void LVStringRecords::addFilenames() {
360 for (StringIds::const_reference Entry : Strings) {
361 StringRef
Name = std::get<1>(
Entry.second);
362 LVScopeCompileUnit *
Scope = std::get<2>(
Entry.second);
368void LVStringRecords::addFilenames(LVScopeCompileUnit *Scope) {
369 for (StringIds::reference Entry : Strings)
370 if (!std::get<2>(
Entry.second))
374void LVNamespaceDeduction::add(StringRef
String) {
375 StringRef InnerComponent;
376 StringRef OuterComponent;
378 DeducedScopes.insert(InnerComponent);
379 if (OuterComponent.
size())
380 UnresolvedScopes.insert(OuterComponent);
383void LVNamespaceDeduction::init() {
390 for (
const StringRef &Unresolved : UnresolvedScopes) {
392 for (
const StringRef &Component : Components) {
393 LookupSet::iterator Iter = DeducedScopes.find(Component);
394 if (Iter == DeducedScopes.end())
395 IdentifiedNamespaces.insert(Component);
400 auto Print = [&](LookupSet &Container,
const char *Title) {
401 auto Header = [&]() {
407 for (
const StringRef &Item : Container)
411 Print(DeducedScopes,
"Deducted Scopes");
412 Print(UnresolvedScopes,
"Unresolved Scopes");
413 Print(IdentifiedNamespaces,
"Namespaces");
417LVScope *LVNamespaceDeduction::get(
LVStringRefs Components) {
419 for (
const StringRef &Component : Components)
423 if (Components.empty())
429 for (
const StringRef &Component : Components) {
436 Namespace->setTag(dwarf::DW_TAG_namespace);
440 add(Component, Namespace);
447LVScope *LVNamespaceDeduction::get(StringRef ScopedName,
bool CheckScope) {
451 LookupSet::iterator Iter = IdentifiedNamespaces.find(Component);
452 return Iter == IdentifiedNamespaces.end();
457 return get(Components);
461#define DEBUG_TYPE "CodeViewTypeVisitor"
466void LVTypeVisitor::printTypeIndex(StringRef FieldName, TypeIndex TI,
467 uint32_t StreamIdx)
const {
482 if (
options().getInternalTag())
483 Shared->TypeKinds.insert(
Record.kind());
487 CurrentTypeIndex = TI;
488 Shared->TypeRecords.add(StreamIdx, TI,
Record.kind());
500 W.getOStream() <<
" {\n";
509 W.startLine() <<
"}\n";
523 W.printNumber(
"NumArgs",
static_cast<uint32_t>(Args.getArgs().size()));
537 String = Ids.getTypeName(TI);
539 Shared->StringRecords.add(TI,
String);
543 String = Ids.getTypeName(TI);
545 Shared->StringRecords.add(TI,
String);
546 LogicalVisitor->setCompileUnitName(std::string(
String));
556 W.printString(
"Name",
Class.getName());
560 Shared->NamespaceDeduction.add(
Class.getName());
561 Shared->ForwardReferences.record(
Class.isForwardRef(),
Class.getName(),
565 Shared->TypeRecords.add(StreamIdx, CurrentTypeIndex,
Class.getName());
574 W.printString(
"Name",
Enum.getName());
578 Shared->NamespaceDeduction.add(
Enum.getName());
588 W.printString(
"Name", Func.getName());
592 Shared->NamespaceDeduction.add(Func.getName());
606 Shared->TypeRecords.add(
StreamTPI, CurrentTypeIndex, {});
615 W.printString(
"StringData",
String.getString());
627 W.printNumber(
"LineNumber",
Line.getLineNumber());
630 Shared->LineRecords.push_back(CurrentTypeIndex);
637 W.printNumber(
"MemberCount",
Union.getMemberCount());
639 W.printNumber(
"SizeOf",
Union.getSize());
640 W.printString(
"Name",
Union.getName());
641 if (
Union.hasUniqueName())
642 W.printString(
"UniqueName",
Union.getUniqueName());
646 Shared->NamespaceDeduction.add(
Union.getName());
647 Shared->ForwardReferences.record(
Union.isForwardRef(),
Union.getName(),
651 Shared->TypeRecords.add(StreamIdx, CurrentTypeIndex,
Union.getName());
656#define DEBUG_TYPE "CodeViewSymbolVisitor"
665 Reader->printRelocatedField(
Label, CoffSection, RelocOffset,
Offset,
672 Reader->getLinkageName(CoffSection, RelocOffset,
Offset, RelocSym);
686 return Reader->CVStringTable;
689void LVSymbolVisitor::printLocalVariableAddrRange(
691 DictScope S(W,
"LocalVariableAddrRange");
693 ObjDelegate->printRelocatedField(
"OffsetStart", RelocationOffset,
695 W.printHex(
"ISectStart",
Range.ISectStart);
696 W.printHex(
"Range",
Range.Range);
699void LVSymbolVisitor::printLocalVariableAddrGap(
703 W.printHex(
"GapStartOffset", Gap.GapStartOffset);
704 W.printHex(
"Range", Gap.Range);
708void LVSymbolVisitor::printTypeIndex(StringRef FieldName, TypeIndex TI)
const {
719 W.printNumber(
"Offset",
Offset);
723 if (
options().getInternalTag())
724 Shared->SymbolKinds.insert(
Kind);
726 LogicalVisitor->CurrentElement = LogicalVisitor->createElement(
Kind);
727 if (!LogicalVisitor->CurrentElement) {
735 IsCompileUnit =
false;
736 if (!LogicalVisitor->CurrentElement->getOffsetFromTypeIndex())
737 LogicalVisitor->CurrentElement->setOffset(
Offset);
739 assert(LogicalVisitor->CurrentScope &&
"Invalid scope!");
740 LogicalVisitor->addElement(LogicalVisitor->CurrentScope, IsCompileUnit);
742 if (LogicalVisitor->CurrentSymbol)
743 LogicalVisitor->addElement(LogicalVisitor->CurrentSymbol);
744 if (LogicalVisitor->CurrentType)
745 LogicalVisitor->addElement(LogicalVisitor->CurrentType);
757 LogicalVisitor->popScope();
771 W.printHex(
"CodeSize",
Block.CodeSize);
772 W.printHex(
"Segment",
Block.Segment);
773 W.printString(
"BlockName",
Block.Name);
776 if (
LVScope *Scope = LogicalVisitor->CurrentScope) {
779 ObjDelegate->getLinkageName(
Block.getRelocationOffset(),
Block.CodeOffset,
783 if (
options().getGeneralCollectRanges()) {
787 Reader->linearAddress(
Block.Segment,
Block.CodeOffset, Addendum);
789 Scope->addObject(LowPC, HighPC);
801 W.printNumber(
"Offset",
Local.Offset);
802 W.printString(
"VarName",
Local.Name);
805 if (
LVSymbol *Symbol = LogicalVisitor->CurrentSymbol) {
806 Symbol->setName(
Local.Name);
814 Symbol->resetIsVariable();
816 if (
Local.Name ==
"this") {
817 Symbol->setIsParameter();
818 Symbol->setIsArtificial();
821 bool(
Local.Offset > 0) ? Symbol->setIsParameter()
822 : Symbol->setIsVariable();
826 if (Symbol->getIsParameter())
827 Symbol->setTag(dwarf::DW_TAG_formal_parameter);
829 setLocalVariableType(Symbol,
Local.Type);
840 W.printNumber(
"Offset",
Local.Offset);
841 W.printString(
"VarName",
Local.Name);
844 if (
LVSymbol *Symbol = LogicalVisitor->CurrentSymbol) {
845 Symbol->setName(
Local.Name);
848 Symbol->resetIsVariable();
851 if (
Local.Name ==
"this") {
852 Symbol->setIsArtificial();
853 Symbol->setIsParameter();
856 determineSymbolKind(Symbol,
Local.Register);
860 if (Symbol->getIsParameter())
861 Symbol->setTag(dwarf::DW_TAG_formal_parameter);
863 setLocalVariableType(Symbol,
Local.Type);
874 W.printNumber(
"Offset",
Local.Offset);
875 W.printNumber(
"OffsetInUdt",
Local.OffsetInUdt);
876 W.printString(
"VarName",
Local.Name);
879 if (
LVSymbol *Symbol = LogicalVisitor->CurrentSymbol) {
880 Symbol->setName(
Local.Name);
883 Symbol->resetIsVariable();
886 if (
Local.Name ==
"this") {
887 Symbol->setIsArtificial();
888 Symbol->setIsParameter();
891 determineSymbolKind(Symbol,
Local.Register);
895 if (Symbol->getIsParameter())
896 Symbol->setTag(dwarf::DW_TAG_formal_parameter);
898 setLocalVariableType(Symbol,
Local.Type);
910 if (
Error Err = LogicalVisitor->finishVisitation(
911 CVBuildType, BuildInfo.
BuildId, Reader->getCompileUnit()))
926 W.printString(
"VersionName", Compile2.
Version);
941 if (
LVScope *Scope = LogicalVisitor->CurrentScope) {
943 Reader->setCompileUnitCPUType(Compile2.
Machine);
944 Scope->setName(CurrentObjectName);
945 if (
options().getAttributeProducer())
946 Scope->setProducer(Compile2.
Version);
947 if (
options().getAttributeLanguage())
954 Reader->addModule(Scope);
957 Shared->StringRecords.addFilenames(Reader->getCompileUnit());
961 CurrentObjectName =
"";
974 W.printString(
"VersionName", Compile3.
Version);
989 if (
LVScope *Scope = LogicalVisitor->CurrentScope) {
991 Reader->setCompileUnitCPUType(Compile3.
Machine);
992 Scope->setName(CurrentObjectName);
993 if (
options().getAttributeProducer())
994 Scope->setProducer(Compile3.
Version);
995 if (
options().getAttributeLanguage())
1002 Reader->addModule(Scope);
1005 Shared->StringRecords.addFilenames(Reader->getCompileUnit());
1009 CurrentObjectName =
"";
1019 W.printString(
"Name",
Constant.Name);
1022 if (
LVSymbol *Symbol = LogicalVisitor->CurrentSymbol) {
1025 Symbol->resetIncludeInPrint();
1038 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1040 W.printNumber(
"Offset", DefRangeFramePointerRelFullScope.
Offset);
1043 if (
LVSymbol *Symbol = LocalSymbol) {
1044 Symbol->setHasCodeViewLocation();
1045 LocalSymbol =
nullptr;
1051 uint64_t Operand1 = DefRangeFramePointerRelFullScope.
Offset;
1052 Symbol->addLocation(Attr, 0, 0, 0, 0);
1053 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1});
1065 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1067 W.printNumber(
"Offset", DefRangeFramePointerRel.
Hdr.
Offset);
1068 printLocalVariableAddrRange(DefRangeFramePointerRel.
Range,
1070 printLocalVariableAddrGap(DefRangeFramePointerRel.
Gaps);
1077 if (
LVSymbol *Symbol = LocalSymbol) {
1078 Symbol->setHasCodeViewLocation();
1079 LocalSymbol =
nullptr;
1084 uint64_t Operand1 = DefRangeFramePointerRel.
Hdr.
Offset;
1088 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1091 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1});
1103 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1105 W.printBoolean(
"HasSpilledUDTMember",
1107 W.printNumber(
"OffsetInParent", DefRangeRegisterRel.
offsetInParent());
1108 W.printNumber(
"BasePointerOffset",
1110 printLocalVariableAddrRange(DefRangeRegisterRel.
Range,
1112 printLocalVariableAddrGap(DefRangeRegisterRel.
Gaps);
1115 if (
LVSymbol *Symbol = LocalSymbol) {
1116 Symbol->setHasCodeViewLocation();
1117 LocalSymbol =
nullptr;
1122 uint64_t Operand1 = DefRangeRegisterRel.
Hdr.
Register;
1127 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1130 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1, Operand2});
1142 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1144 W.printBoolean(
"HasSpilledUDTMember",
1146 W.printNumber(
"OffsetInParent", DefRangeRegisterRelIndir.
offsetInParent());
1147 W.printNumber(
"BasePointerOffset",
1149 W.printNumber(
"OffsetInUdt", DefRangeRegisterRelIndir.
Hdr.
OffsetInUdt);
1150 printLocalVariableAddrRange(DefRangeRegisterRelIndir.
Range,
1152 printLocalVariableAddrGap(DefRangeRegisterRelIndir.
Gaps);
1155 if (
LVSymbol *Symbol = LocalSymbol) {
1156 Symbol->setHasCodeViewLocation();
1157 LocalSymbol =
nullptr;
1162 const uint64_t Operand1 = DefRangeRegisterRelIndir.
Hdr.
Register;
1164 const uint64_t Operand3 = DefRangeRegisterRelIndir.
Hdr.
OffsetInUdt;
1168 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1171 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1, Operand2, Operand3});
1183 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1185 W.printEnum(
"Register", uint16_t(DefRangeRegister.
Hdr.
Register),
1188 printLocalVariableAddrRange(DefRangeRegister.
Range,
1190 printLocalVariableAddrGap(DefRangeRegister.
Gaps);
1193 if (
LVSymbol *Symbol = LocalSymbol) {
1194 Symbol->setHasCodeViewLocation();
1195 LocalSymbol =
nullptr;
1199 uint64_t Operand1 = DefRangeRegister.
Hdr.
Register;
1203 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1206 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1});
1218 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1220 W.printEnum(
"Register", uint16_t(DefRangeSubfieldRegister.
Hdr.
Register),
1222 W.printNumber(
"MayHaveNoName", DefRangeSubfieldRegister.
Hdr.
MayHaveNoName);
1223 W.printNumber(
"OffsetInParent",
1225 printLocalVariableAddrRange(DefRangeSubfieldRegister.
Range,
1227 printLocalVariableAddrGap(DefRangeSubfieldRegister.
Gaps);
1230 if (
LVSymbol *Symbol = LocalSymbol) {
1231 Symbol->setHasCodeViewLocation();
1232 LocalSymbol =
nullptr;
1237 uint64_t Operand1 = DefRangeSubfieldRegister.
Hdr.
Register;
1241 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1244 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1});
1256 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1261 if (!ExpectedProgram) {
1264 "String table offset outside of bounds of String Table!");
1266 W.printString(
"Program", *ExpectedProgram);
1268 W.printNumber(
"OffsetInParent", DefRangeSubfield.
OffsetInParent);
1269 printLocalVariableAddrRange(DefRangeSubfield.
Range,
1271 printLocalVariableAddrGap(DefRangeSubfield.
Gaps);
1274 if (
LVSymbol *Symbol = LocalSymbol) {
1275 Symbol->setHasCodeViewLocation();
1276 LocalSymbol =
nullptr;
1280 uint64_t Operand1 = DefRangeSubfield.
Program;
1284 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1287 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1, 0});
1299 W.getOStream() <<
formatv(
"Symbol: {0}, ", LocalSymbol->getName());
1304 if (!ExpectedProgram) {
1307 "String table offset outside of bounds of String Table!");
1309 W.printString(
"Program", *ExpectedProgram);
1312 printLocalVariableAddrGap(DefRange.
Gaps);
1315 if (
LVSymbol *Symbol = LocalSymbol) {
1316 Symbol->setHasCodeViewLocation();
1317 LocalSymbol =
nullptr;
1321 uint64_t Operand1 = DefRange.
Program;
1325 Reader->linearAddress(
Range.ISectStart,
Range.OffsetStart);
1328 Symbol->addLocationOperands(
LVSmall(Attr), {Operand1, 0});
1371 W.printString(
"DisplayName",
Data.Name);
1374 if (
LVSymbol *Symbol = LogicalVisitor->CurrentSymbol) {
1377 ObjDelegate->getLinkageName(
Data.getRelocationOffset(),
Data.DataOffset,
1380 Symbol->setName(
Data.Name);
1389 if (
getReader().isSystemEntry(Symbol) && !
options().getAttributeSystem()) {
1390 Symbol->resetIncludeInPrint();
1394 if (
LVScope *Namespace = Shared->NamespaceDeduction.get(
Data.Name)) {
1397 if (Symbol->getParentScope()->removeElement(Symbol))
1398 Namespace->addElement(Symbol);
1401 Symbol->setType(LogicalVisitor->getElement(
StreamTPI,
Data.Type));
1402 if (
Record.kind() == SymbolKind::S_GDATA32)
1403 Symbol->setIsExternal();
1414 if (
LVScope *InlinedFunction = LogicalVisitor->CurrentScope) {
1415 LVScope *AbstractFunction = Reader->createScopeFunction();
1416 AbstractFunction->setIsSubprogram();
1417 AbstractFunction->
setTag(dwarf::DW_TAG_subprogram);
1419 AbstractFunction->setIsInlinedAbstract();
1422 LogicalVisitor->startProcessArgumentList();
1425 if (
Error Err = LogicalVisitor->finishVisitation(
1426 CVFunctionType,
InlineSite.Inlinee, AbstractFunction))
1428 LogicalVisitor->stopProcessArgumentList();
1433 InlinedFunction->setName(
Name);
1434 InlinedFunction->setLinkageName(
Name);
1437 if (
Error Err = LogicalVisitor->inlineSiteAnnotation(
1438 AbstractFunction, InlinedFunction,
InlineSite))
1450 W.printString(
"VarName",
Local.Name);
1453 if (
LVSymbol *Symbol = LogicalVisitor->CurrentSymbol) {
1454 Symbol->setName(
Local.Name);
1457 Symbol->resetIsVariable();
1461 Local.Name ==
"this") {
1462 Symbol->setIsArtificial();
1463 Symbol->setIsParameter();
1466 : Symbol->setIsVariable();
1470 if (Symbol->getIsParameter())
1471 Symbol->setTag(dwarf::DW_TAG_formal_parameter);
1473 setLocalVariableType(Symbol,
Local.Type);
1478 LocalSymbol = Symbol;
1487 W.printHex(
"Signature", ObjName.
Signature);
1488 W.printString(
"ObjectName", ObjName.
Name);
1491 CurrentObjectName = ObjName.
Name;
1497 if (InFunctionScope)
1501 InFunctionScope =
true;
1505 W.printHex(
"Segment", Proc.
Segment);
1506 W.printFlags(
"Flags",
static_cast<uint8_t>(Proc.
Flags),
1508 W.printString(
"DisplayName", Proc.
Name);
1557 if (
options().getGeneralCollectRanges()) {
1563 Function->addObject(LowPC, HighPC);
1566 if ((
options().getAttributePublics() ||
options().getPrintAnyLine()) &&
1568 Reader->getCompileUnit()->addPublicName(
Function, LowPC, HighPC);
1589 TypeIndex TI = Shared->ForwardReferences.find(OuterComponent);
1591 std::optional<CVType> CVFunctionType;
1592 auto GetRecordType = [&]() ->
bool {
1593 CVFunctionType = Ids.tryGetType(TIFunctionType);
1594 if (!CVFunctionType)
1599 if (CVFunctionType->kind() == LF_FUNC_ID)
1603 return (CVFunctionType->kind() == LF_MFUNC_ID);
1607 if (!GetRecordType()) {
1608 CVFunctionType = Types.tryGetType(TIFunctionType);
1609 if (!CVFunctionType)
1613 if (
Error Err = LogicalVisitor->finishVisitation(
1614 *CVFunctionType, TIFunctionType,
Function))
1618 if (
Record.kind() == SymbolKind::S_GPROC32 ||
1619 Record.kind() == SymbolKind::S_GPROC32_ID)
1625 if (DemangledSymbol.find(
"scalar deleting dtor") != std::string::npos) {
1630 if (DemangledSymbol.find(
"dynamic atexit destructor for") !=
1642 InFunctionScope =
false;
1648 if (InFunctionScope)
1652 InFunctionScope =
true;
1655 W.printHex(
"Segment",
Thunk.Segment);
1656 W.printString(
"Name",
Thunk.Name);
1669 W.printString(
"UDTName",
UDT.Name);
1672 if (
LVType *
Type = LogicalVisitor->CurrentType) {
1673 if (
LVScope *Namespace = Shared->NamespaceDeduction.get(
UDT.Name)) {
1674 if (
Type->getParentScope()->removeElement(
Type))
1675 Namespace->addElement(
Type);
1688 Type->resetIncludeInPrint();
1691 if (
UDT.Name == RecordName)
1692 Type->resetIncludeInPrint();
1711 W.printHex(
"BaseOffset",
JumpTable.BaseOffset);
1712 W.printNumber(
"BaseSegment",
JumpTable.BaseSegment);
1713 W.printFlags(
"SwitchType",
static_cast<uint16_t
>(
JumpTable.SwitchType),
1715 W.printHex(
"BranchOffset",
JumpTable.BranchOffset);
1716 W.printHex(
"TableOffset",
JumpTable.TableOffset);
1717 W.printNumber(
"BranchSegment",
JumpTable.BranchSegment);
1718 W.printNumber(
"TableSegment",
JumpTable.TableSegment);
1719 W.printNumber(
"EntriesCount",
JumpTable.EntriesCount);
1728 switch (
Caller.getKind()) {
1729 case SymbolRecordKind::CallerSym:
1730 FieldName =
"Callee";
1732 case SymbolRecordKind::CalleeSym:
1733 FieldName =
"Caller";
1735 case SymbolRecordKind::InlineesSym:
1736 FieldName =
"Inlinee";
1740 "Unknown CV Record type for a CallerSym object!");
1742 for (
auto FuncID :
Caller.Indices) {
1751 if (Element && Element->getIsScoped()) {
1770#define DEBUG_TYPE "CodeViewLogicalVisitor"
1777 : Reader(Reader), W(W), Input(Input) {
1780 Shared = std::make_shared<LVShared>(Reader,
this);
1786 StreamIdx ==
StreamTPI ? types() : ids());
1791 W.getOStream() <<
"\n";
1794 W.getOStream() <<
" {\n";
1799 << Element->
getName() <<
"\n";
1804 W.startLine() <<
"}\n";
1810 W.getOStream() <<
"\n";
1813 W.getOStream() <<
" {\n";
1818 << Element->
getName() <<
"\n";
1823 W.startLine() <<
"}\n";
1841 W.printNumber(
"NumArgs",
Size);
1850 TypeIndex ParameterType = Indices[Index];
1864 W.printNumber(
"SizeOf", AT.
getSize());
1865 W.printString(
"Name", AT.
getName());
1869 if (Element->getIsFinalized())
1871 Element->setIsFinalized();
1877 Reader->getCompileUnit()->addElement(Array);
1880 LVType *PrevSubrange =
nullptr;
1888 Subrange->setTag(dwarf::DW_TAG_subrange_type);
1913 while (CVEntry.
kind() == LF_ARRAY) {
1924 AddSubrangeType(AR);
1925 TIArrayType = TIElementType;
1931 CVType CVElementType =
Types.getType(TIElementType);
1932 if (CVElementType.
kind() == LF_MODIFIER) {
1934 Shared->TypeRecords.find(
StreamTPI, TIElementType);
1947 CVEntry =
Types.getType(TIElementType);
1949 const_cast<CVType &
>(CVEntry), AR)) {
1959 TIArrayType = Shared->ForwardReferences.remap(TIArrayType);
2020 W.printNumber(
"MemberCount",
Class.getMemberCount());
2024 W.printNumber(
"SizeOf",
Class.getSize());
2025 W.printString(
"Name",
Class.getName());
2026 if (
Class.hasUniqueName())
2027 W.printString(
"UniqueName",
Class.getUniqueName());
2031 if (Element->getIsFinalized())
2033 Element->setIsFinalized();
2039 Scope->setName(
Class.getName());
2040 if (
Class.hasUniqueName())
2041 Scope->setLinkageName(
Class.getUniqueName());
2044 if (
Class.isNested()) {
2045 Scope->setIsNested();
2046 createParents(
Class.getName(), Scope);
2049 if (
Class.isScoped())
2050 Scope->setIsScoped();
2054 if (!(
Class.isNested() ||
Class.isScoped())) {
2055 if (
LVScope *Namespace = Shared->NamespaceDeduction.get(
Class.getName()))
2056 Namespace->addElement(Scope);
2058 Reader->getCompileUnit()->addElement(Scope);
2064 TypeIndex ForwardType = Shared->ForwardReferences.find(
Class.getName());
2070 const_cast<CVType &
>(CVReference), ReferenceRecord))
2091 W.printNumber(
"NumEnumerators",
Enum.getMemberCount());
2094 W.printString(
"Name",
Enum.getName());
2102 if (Scope->getIsFinalized())
2104 Scope->setIsFinalized();
2108 Scope->setName(
Enum.getName());
2109 if (
Enum.hasUniqueName())
2110 Scope->setLinkageName(
Enum.getUniqueName());
2114 if (
Enum.isNested()) {
2115 Scope->setIsNested();
2116 createParents(
Enum.getName(), Scope);
2119 if (
Enum.isScoped()) {
2120 Scope->setIsScoped();
2121 Scope->setIsEnumClass();
2125 if (!(
Enum.isNested() ||
Enum.isScoped())) {
2126 if (
LVScope *Namespace = Shared->NamespaceDeduction.get(
Enum.getName()))
2127 Namespace->addElement(Scope);
2129 Reader->getCompileUnit()->addElement(Scope);
2152 if (
Error Err = visitFieldListMemberStream(TI, Element,
FieldList.Data))
2166 W.printString(
"Name", Func.getName());
2178 TypeIndex TIParent = Func.getParentScope();
2179 if (FunctionDcl->getIsInlinedAbstract()) {
2180 FunctionDcl->setName(Func.getName());
2182 Reader->getCompileUnit()->addElement(FunctionDcl);
2186 CVType CVParentScope = ids().getType(TIParent);
2191 TypeIndex TIFunctionType = Func.getFunctionType();
2192 CVType CVFunctionType =
Types.getType(TIFunctionType);
2197 FunctionDcl->setIsFinalized();
2221 W.printString(
"Name", Id.getName());
2226 if (FunctionDcl->getIsInlinedAbstract()) {
2232 Shared->TypeRecords.find(
StreamTPI, Id.getClassType())))
2233 Class->addElement(FunctionDcl);
2236 TypeIndex TIFunctionType = Id.getFunctionType();
2237 CVType CVFunction = types().getType(TIFunctionType);
2262 MemberFunction->setIsFinalized();
2264 MemberFunction->setOffset(TI.
getIndex());
2265 MemberFunction->setOffsetFromTypeIndex();
2267 if (ProcessArgumentList) {
2268 ProcessArgumentList =
false;
2270 if (!MemberFunction->getIsStatic()) {
2275 createParameter(ThisPointer,
StringRef(), MemberFunction);
2276 This->setIsArtificial();
2303 Method.Name = OverloadedMethodName;
2335 bool SeenModifier =
false;
2336 uint16_t Mods =
static_cast<uint16_t
>(
Mod.getModifiers());
2338 SeenModifier =
true;
2339 LastLink->
setTag(dwarf::DW_TAG_const_type);
2340 LastLink->setIsConst();
2351 LastLink->
setTag(dwarf::DW_TAG_volatile_type);
2352 LastLink->setIsVolatile();
2353 LastLink->
setName(
"volatile");
2364 LastLink->setIsUnaligned();
2365 LastLink->
setName(
"unaligned");
2368 LastLink->
setType(ModifiedType);
2378 W.printNumber(
"IsFlat", Ptr.
isFlat());
2379 W.printNumber(
"IsConst", Ptr.
isConst());
2380 W.printNumber(
"IsVolatile", Ptr.
isVolatile());
2382 W.printNumber(
"IsRestrict", Ptr.
isRestrict());
2385 W.printNumber(
"SizeOf", Ptr.
getSize());
2410 bool SeenModifier =
false;
2416 SeenModifier =
true;
2418 Restrict->setTag(dwarf::DW_TAG_restrict_type);
2427 LVType *LReference = Reader->createType();
2428 LReference->setIsModifier();
2429 LastLink->
setType(LReference);
2430 LastLink = LReference;
2433 LastLink->
setTag(dwarf::DW_TAG_reference_type);
2434 LastLink->setIsReference();
2439 LVType *RReference = Reader->createType();
2440 RReference->setIsModifier();
2441 LastLink->
setType(RReference);
2442 LastLink = RReference;
2445 LastLink->
setTag(dwarf::DW_TAG_rvalue_reference_type);
2446 LastLink->setIsRvalueReference();
2472 if (ProcessArgumentList) {
2473 ProcessArgumentList =
false;
2491 W.printNumber(
"MemberCount",
Union.getMemberCount());
2493 W.printNumber(
"SizeOf",
Union.getSize());
2494 W.printString(
"Name",
Union.getName());
2495 if (
Union.hasUniqueName())
2496 W.printString(
"UniqueName",
Union.getUniqueName());
2504 if (Scope->getIsFinalized())
2506 Scope->setIsFinalized();
2508 Scope->setName(
Union.getName());
2509 if (
Union.hasUniqueName())
2510 Scope->setLinkageName(
Union.getUniqueName());
2513 if (
Union.isNested()) {
2514 Scope->setIsNested();
2515 createParents(
Union.getName(), Scope);
2517 if (
LVScope *Namespace = Shared->NamespaceDeduction.get(
Union.getName()))
2518 Namespace->addElement(Scope);
2520 Reader->getCompileUnit()->addElement(Scope);
2523 if (!
Union.getFieldList().isNoneType()) {
2540 W.printNumber(
"Age", TS.
getAge());
2541 W.printString(
"Name", TS.
getName());
2555 W.printString(
"VFTableName", VFT.
getName());
2557 W.printString(
"MethodName",
N);
2584 W.printNumber(
"NumStrings",
Size);
2600 W.printString(
"StringData",
String.getString());
2603 if (
LVScope *Namespace = Shared->NamespaceDeduction.get(
2604 String.getString(),
false)) {
2608 Scope->removeElement(Element);
2609 Namespace->addElement(Element);
2640 W.printNumber(
"Module", ModSourceLine.
getModule());
2685 W.printHex(
"BaseOffset",
Base.getBaseOffset());
2694 Symbol->setAccessibilityCode(
Base.getAccess());
2708 W.printHex(
"FieldOffset",
Field.getFieldOffset());
2709 W.printString(
"Name",
Field.getName());
2725 W.printNumber(
"EnumValue",
Enum.getValue());
2726 W.printString(
"Name",
Enum.getName());
2734 Enum.getValue().toString(
Value, 16,
true,
true);
2761 W.printString(
"Name",
Nested.getName());
2772 if (NestedType && NestedType->getIsNested()) {
2778 if (NestedTypeName.
size() && RecordName.
size()) {
2780 std::tie(OuterComponent, std::ignore) =
2784 if (OuterComponent.
size() && OuterComponent == RecordName) {
2785 if (!NestedType->getIsScopedAlready()) {
2786 Scope->addElement(NestedType);
2787 NestedType->setIsScopedAlready();
2790 Typedef->resetIncludeInPrint();
2807 if (Method.isIntroducingVirtual())
2808 W.printHex(
"VFTableOffset", Method.getVFTableOffset());
2809 W.printString(
"Name", Method.getName());
2816 ProcessArgumentList =
true;
2818 MemberFunction->setIsFinalized();
2821 MemberFunction->
setName(Method.getName());
2822 MemberFunction->setAccessibilityCode(Method.getAccess());
2826 MemberFunction->setIsStatic();
2827 MemberFunction->setVirtualityCode(
Kind);
2832 MemberFunction->setIsArtificial();
2835 CVType CVMethodType =
Types.getType(Method.getType());
2840 ProcessArgumentList =
false;
2851 W.printHex(
"MethodCount", Method.getNumOverloads());
2853 W.printString(
"Name", Method.getName());
2860 OverloadedMethodName = Method.getName();
2861 CVType CVMethods =
Types.getType(Method.getMethodList());
2875 W.printString(
"Name",
Field.getName());
2905 W.printHex(
"VBPtrOffset",
Base.getVBPtrOffset());
2906 W.printHex(
"VBTableIndex",
Base.getVTableIndex());
2915 Symbol->setAccessibilityCode(
Base.getAccess());
2934#define MEMBER_RECORD(EnumName, EnumVal, Name) \
2937 visitKnownMember<Name##Record>(Record, Callbacks, TI, Element)) \
2941#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \
2942 MEMBER_RECORD(EnumVal, EnumVal, AliasName)
2943#define TYPE_RECORD(EnumName, EnumVal, Name)
2944#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
2945#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
2961#define TYPE_RECORD(EnumName, EnumVal, Name) \
2963 if (Error Err = visitKnownRecord<Name##Record>(Record, TI, Element)) \
2967#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \
2968 TYPE_RECORD(EnumVal, EnumVal, AliasName)
2969#define MEMBER_RECORD(EnumName, EnumVal, Name)
2970#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
2971#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
2978Error LVLogicalVisitor::visitFieldListMemberStream(
2987 while (!Reader.empty()) {
2988 if (
Error Err = Reader.readEnum(Leaf))
3006 if (!ScopeStack.empty())
3008 InCompileUnitScope =
true;
3012 ReaderParent->addElement(Scope);
3016 ReaderScope->addElement(Symbol);
3020 ReaderScope->addElement(
Type);
3032 if (
options().getAttributeBase())
3039 case TypeLeafKind::LF_ENUMERATE:
3043 case TypeLeafKind::LF_MODIFIER:
3047 case TypeLeafKind::LF_POINTER:
3055 case TypeLeafKind::LF_BCLASS:
3056 case TypeLeafKind::LF_IVBCLASS:
3057 case TypeLeafKind::LF_VBCLASS:
3062 case TypeLeafKind::LF_MEMBER:
3063 case TypeLeafKind::LF_STMEMBER:
3070 case TypeLeafKind::LF_ARRAY:
3074 case TypeLeafKind::LF_CLASS:
3075 case TypeLeafKind::LF_CLASS2:
3080 case TypeLeafKind::LF_ENUM:
3084 case TypeLeafKind::LF_METHOD:
3085 case TypeLeafKind::LF_ONEMETHOD:
3086 case TypeLeafKind::LF_PROCEDURE:
3091 case TypeLeafKind::LF_STRUCTURE:
3092 case TypeLeafKind::LF_STRUCTURE2:
3097 case TypeLeafKind::LF_UNION:
3098 case TypeLeafKind::LF_UNION2:
3117 case SymbolKind::S_UDT:
3123 case SymbolKind::S_CONSTANT:
3129 case SymbolKind::S_BPREL32:
3130 case SymbolKind::S_REGREL32:
3131 case SymbolKind::S_REGREL32_INDIR:
3132 case SymbolKind::S_GDATA32:
3133 case SymbolKind::S_LDATA32:
3134 case SymbolKind::S_LOCAL:
3144 case SymbolKind::S_BLOCK32:
3149 case SymbolKind::S_COMPILE2:
3150 case SymbolKind::S_COMPILE3:
3155 case SymbolKind::S_INLINESITE:
3156 case SymbolKind::S_INLINESITE2:
3159 CurrentScope->setTag(dwarf::DW_TAG_inlined_subroutine);
3161 case SymbolKind::S_LPROC32:
3162 case SymbolKind::S_GPROC32:
3163 case SymbolKind::S_LPROC32_ID:
3164 case SymbolKind::S_GPROC32_ID:
3165 case SymbolKind::S_SEPCODE:
3166 case SymbolKind::S_THUNK32:
3186 Element->setIsFinalized();
3196 Element->setOffsetFromTypeIndex();
3200 W.printString(
"** Not implemented. **");
3207 Element->setOffsetFromTypeIndex();
3221 Symbol->setName(
Name);
3226 CVType CVMemberType = Types.getType(TI);
3227 if (CVMemberType.
kind() == LF_BITFIELD) {
3242 LVSymbol *
Parameter = Reader->createSymbol();
3245 Parameter->setTag(dwarf::DW_TAG_formal_parameter);
3256LVType *LVLogicalVisitor::createBaseType(
TypeIndex TI, StringRef TypeName) {
3258 TypeIndex TIR = (TypeIndex)SimpleKind;
3261 W.printString(
"TypeName", TypeName);
3264 if (LVElement *Element = Shared->TypeRecords.find(
StreamTPI, TIR))
3265 return static_cast<LVType *
>(Element);
3270 Reader->getCompileUnit()->addElement(
CurrentType);
3275LVType *LVLogicalVisitor::createPointerType(
TypeIndex TI, StringRef TypeName) {
3278 W.printString(
"TypeName", TypeName);
3281 if (LVElement *Element = Shared->TypeRecords.find(
StreamTPI, TI))
3282 return static_cast<LVType *
>(Element);
3284 LVType *Pointee = createBaseType(TI,
TypeName.drop_back(1));
3288 Reader->getCompileUnit()->addElement(
CurrentType);
3293void LVLogicalVisitor::createParents(StringRef ScopedName,
LVElement *Element) {
3313 if (Components.size() < 2)
3315 Components.pop_back();
3317 LVStringRefs::size_type FirstNamespace;
3318 LVStringRefs::size_type FirstAggregate;
3319 std::tie(FirstNamespace, FirstAggregate) =
3320 Shared->NamespaceDeduction.find(Components);
3323 W.printString(
"First Namespace", Components[FirstNamespace]);
3324 W.printString(
"First NonNamespace", Components[FirstAggregate]);
3328 if (FirstNamespace < FirstAggregate) {
3329 Shared->NamespaceDeduction.get(
3331 Components.begin() + FirstAggregate));
3337 LVScope *Aggregate =
nullptr;
3338 TypeIndex TIAggregate;
3340 LVStringRefs(Components.begin(), Components.begin() + FirstAggregate));
3343 for (LVStringRefs::size_type Index = FirstAggregate;
3346 Components.begin() + Index + 1),
3348 TIAggregate = Shared->ForwardReferences.remap(
3349 Shared->TypeRecords.find(
StreamTPI, AggregateName));
3359 if (Aggregate && !Element->getIsScopedAlready()) {
3361 Element->setIsScopedAlready();
3368 TI = Shared->ForwardReferences.remap(TI);
3371 LVElement *Element = Shared->TypeRecords.find(StreamIdx, TI);
3379 return (TypeName.back() ==
'*') ? createPointerType(TI, TypeName)
3380 : createBaseType(TI, TypeName);
3388 if (Element->getIsFinalized())
3402 Element->setIsFinalized();
3409 for (
const TypeIndex &Entry : Shared->LineRecords) {
3419 W.printNumber(
"LineNumber",
Line.getLineNumber());
3425 if (
LVElement *Element = Shared->TypeRecords.find(
3429 Shared->StringRecords.findIndex(
Line.getSourceFile()));
3437 Shared->NamespaceDeduction.init();
3443 if (!
options().getInternalTag())
3448 auto NewLine = [&]() {
3461 Shared->TypeKinds.clear();
3464 OS <<
"\nSymbols:\n";
3467 Shared->SymbolKinds.clear();
3481 ParentLowPC = (*
Locations->begin())->getLowerAddress();
3488 LVInlineeInfo::iterator Iter = InlineeInfo.find(
InlineSite.Inlinee);
3489 if (Iter != InlineeInfo.end()) {
3490 LineNumber = Iter->second.first;
3499 dbgs() <<
"inlineSiteAnnotation\n"
3500 <<
"Abstract: " << AbstractFunction->
getName() <<
"\n"
3501 <<
"Inlined: " << InlinedFunction->
getName() <<
"\n"
3502 <<
"Parent: " << Parent->
getName() <<
"\n"
3503 <<
"Low PC: " <<
hexValue(ParentLowPC) <<
"\n";
3507 if (!
options().getPrintLines())
3514 int32_t LineOffset = LineNumber;
3518 auto UpdateCodeOffset = [&](
uint32_t Delta) {
3525 auto UpdateLineOffset = [&](int32_t Delta) {
3526 LineOffset += Delta;
3528 char Sign = Delta > 0 ?
'+' :
'-';
3533 auto UpdateFileOffset = [&](int32_t
Offset) {
3539 auto CreateLine = [&]() {
3543 Line->setLineNumber(LineOffset);
3550 bool SeenLowAddress =
false;
3551 bool SeenHighAddress =
false;
3553 uint64_t HighPC = 0;
3555 for (
auto &Annot :
InlineSite.annotations()) {
3562 switch (Annot.OpCode) {
3566 UpdateCodeOffset(Annot.U1);
3571 SeenLowAddress =
true;
3576 SeenHighAddress =
true;
3580 UpdateCodeOffset(Annot.U2);
3585 UpdateCodeOffset(Annot.U1);
3586 UpdateLineOffset(Annot.S1);
3593 UpdateFileOffset(Annot.U1);
3599 if (SeenLowAddress && SeenHighAddress) {
3600 SeenLowAddress =
false;
3601 SeenHighAddress =
false;
3602 InlinedFunction->
addObject(LowPC, HighPC);
3606 Reader->addInlineeLines(InlinedFunction,
InlineeLines);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Lower Kernel Arguments
OptimizedStructLayoutField Field
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.
Provides read only access to a subclass of BinaryStream.
This is an important base class in LLVM.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringRef getName() const
void setName(const Init *Name)
virtual void printString(StringRef Value)
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Represent a constant reference to a string, i.e.
constexpr size_t size() const
Get the string size.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
LLVM_ABI Value(Type *Ty, unsigned scid)
TypeIndex getElementType() const
TypeIndex getIndexType() const
StringRef getName() const
uint8_t getBitSize() const
TypeIndex getType() const
uint8_t getBitOffset() const
@ CurrentDirectory
Absolute CWD path.
@ SourceFile
Path to main source file, relative or absolute.
ArrayRef< TypeIndex > getArgs() const
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
uint8_t getLanguage() const
uint32_t getFlags() const
CompileSym3Flags getFlags() const
SourceLanguage getLanguage() const
Represents a read-only view of a CodeView string table.
LLVM_ABI Expected< StringRef > getString(uint32_t Offset) const
DefRangeFramePointerRelHeader Hdr
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
S_DEFRANGE_REGISTER_REL_INDIR.
uint16_t offsetInParent() const
std::vector< LocalVariableAddrGap > Gaps
uint32_t getRelocationOffset() const
bool hasSpilledUDTMember() const
DefRangeRegisterRelIndirHeader Hdr
LocalVariableAddrRange Range
DefRangeRegisterRelHeader Hdr
bool hasSpilledUDTMember() const
uint32_t getRelocationOffset() const
uint16_t offsetInParent() const
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
DefRangeRegisterHeader Hdr
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
DefRangeSubfieldRegisterHeader Hdr
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
uint32_t getRelocationOffset() const
LocalVariableAddrRange Range
uint32_t getSignature() const
RegisterId getLocalFramePtrReg(CPUType CPU) const
Extract the register this frame uses to refer to local variables.
RegisterId getParamFramePtrReg(CPUType CPU) const
Extract the register this frame uses to refer to parameters.
FrameProcedureOptions Flags
Provides amortized O(1) random access to a CodeView type stream.
LF_INDEX - Used to chain two large LF_FIELDLIST or LF_METHODLIST records together.
TypeIndex getContinuationIndex() const
TypeIndex getReturnType() const
int32_t getThisPointerAdjustment() const
TypeIndex getArgumentList() const
uint16_t getParameterCount() const
TypeIndex getThisType() const
TypeIndex getClassType() const
std::vector< OneMethodRecord > Methods
For method overload sets. LF_METHOD.
bool isRValueReferenceThisPtr() const
TypeIndex getReferentType() const
MemberPointerInfo getMemberInfo() const
bool isPointerToMember() const
bool isLValueReferenceThisPtr() const
PointerMode getMode() const
uint32_t getSignature() const
StringRef getPrecompFilePath() const
uint32_t getTypesCount() const
uint32_t getStartTypeIndex() const
uint32_t getRelocationOffset() const
TypeIndex getReturnType() const
TypeIndex getArgumentList() const
uint16_t getParameterCount() const
ArrayRef< TypeIndex > getIndices() const
TypeIndex getFieldList() const
static Error deserializeAs(CVType &CVT, T &Record)
static TypeIndex fromArrayIndex(uint32_t Index)
SimpleTypeKind getSimpleKind() const
void setIndex(uint32_t I)
static const uint32_t FirstNonSimpleIndex
static LLVM_ABI StringRef simpleTypeName(TypeIndex TI)
uint32_t getIndex() const
StringRef getName() const
const GUID & getGuid() const
void addCallbackToPipeline(TypeVisitorCallbacks &Callbacks)
virtual Error visitUnknownMember(CVMemberRecord &Record)
virtual Error visitMemberEnd(CVMemberRecord &Record)
virtual Error visitMemberBegin(CVMemberRecord &Record)
TypeIndex getSourceFile() const
uint16_t getModule() const
uint32_t getLineNumber() const
uint32_t getLineNumber() const
TypeIndex getSourceFile() const
TypeIndex getType() const
uint32_t getVFPtrOffset() const
TypeIndex getOverriddenVTable() const
ArrayRef< StringRef > getMethodNames() const
StringRef getName() const
TypeIndex getCompleteClass() const
uint32_t getEntryCount() const
Stores all information relating to a compile unit, be it in its original instance in the object file ...
static StringRef getSymbolKindName(SymbolKind Kind)
virtual void setCount(int64_t Value)
virtual void setBitSize(uint32_t Size)
LVScope * getFunctionParent() const
virtual void updateLevel(LVScope *Parent, bool Moved=false)
virtual int64_t getCount() const
void setInlineCode(uint32_t Code)
virtual void setReference(LVElement *Element)
void setName(StringRef ElementName) override
StringRef getName() const override
void setType(LVElement *Element=nullptr)
void setFilenameIndex(size_t Index)
LLVM_ABI Error visitKnownRecord(CVType &Record, ArgListRecord &Args, TypeIndex TI, LVElement *Element)
LLVM_ABI void printRecords(raw_ostream &OS) const
LLVM_ABI void printTypeEnd(CVType &Record)
LLVM_ABI Error visitMemberRecord(CVMemberRecord &Record, TypeVisitorCallbacks &Callbacks, TypeIndex TI, LVElement *Element)
LLVM_ABI Error visitKnownMember(CVMemberRecord &Record, BaseClassRecord &Base, TypeIndex TI, LVElement *Element)
LLVM_ABI void printMemberEnd(CVMemberRecord &Record)
LLVM_ABI Error inlineSiteAnnotation(LVScope *AbstractFunction, LVScope *InlinedFunction, InlineSiteSym &InlineSite)
LLVM_ABI LVLogicalVisitor(LVCodeViewReader *Reader, ScopedPrinter &W, llvm::pdb::InputFile &Input)
LLVM_ABI void printTypeIndex(StringRef FieldName, TypeIndex TI, uint32_t StreamIdx)
LLVM_ABI Error visitUnknownMember(CVMemberRecord &Record, TypeIndex TI)
void pushScope(LVScope *Scope)
LLVM_ABI Error visitUnknownType(CVType &Record, TypeIndex TI)
LLVM_ABI void processNamespaces()
LLVM_ABI void addElement(LVScope *Scope, bool IsCompileUnit)
LLVM_ABI void printTypeBegin(CVType &Record, TypeIndex TI, LVElement *Element, uint32_t StreamIdx)
LLVM_ABI void processLines()
LLVM_ABI LVElement * getElement(uint32_t StreamIdx, TypeIndex TI, LVScope *Parent=nullptr)
LLVM_ABI void printMemberBegin(CVMemberRecord &Record, TypeIndex TI, LVElement *Element, uint32_t StreamIdx)
LLVM_ABI Error finishVisitation(CVType &Record, TypeIndex TI, LVElement *Element)
LLVM_ABI LVElement * createElement(TypeLeafKind Kind)
LLVM_ABI void processFiles()
LVScope * getParentScope() const
void setOffset(LVOffset DieOffset)
LVOffset getOffset() const
void setLineNumber(uint32_t Number)
void setTag(dwarf::Tag Tag)
virtual bool isSystemEntry(LVElement *Element, StringRef Name={}) const
LVScopeCompileUnit * getCompileUnit() const
void addElement(LVElement *Element)
void addObject(LVLocation *Location)
const LVLocations * getRanges() const
void getLinkageName(uint32_t RelocOffset, uint32_t Offset, StringRef *RelocSym=nullptr)
void printRelocatedField(StringRef Label, uint32_t RelocOffset, uint32_t Offset, StringRef *RelocSym=nullptr)
DebugStringTableSubsectionRef getStringTable() override
StringRef getFileNameForFileOffset(uint32_t FileOffset) override
Error visitSymbolEnd(CVSymbol &Record) override
Error visitKnownRecord(CVSymbol &Record, BlockSym &Block) override
Error visitSymbolBegin(CVSymbol &Record) override
Error visitUnknownSymbol(CVSymbol &Record) override
Action to take on unknown symbols. By default, they are ignored.
Error visitMemberEnd(CVMemberRecord &Record) override
Error visitUnknownMember(CVMemberRecord &Record) override
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
Error visitMemberBegin(CVMemberRecord &Record) override
Error visitKnownRecord(CVType &Record, BuildInfoRecord &Args) override
Error visitUnknownType(CVType &Record) override
Action to take on unknown types. By default, they are ignored.
This class implements an extremely fast bulk output stream that can only output to a stream.
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
@ ChangeCodeLengthAndCodeOffset
@ ChangeCodeOffsetAndLineOffset
PointerMode
Equivalent to CV_ptrmode_e.
MethodKind
Part of member attribute flags. (CV_methodprop_e)
CVRecord< TypeLeafKind > CVType
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
LLVM_ABI EnumStrings< SourceLanguage, 1 > getSourceLanguageNames()
LLVM_ABI EnumStrings< unsigned, 1 > getCPUTypeNames()
LLVM_ABI EnumStrings< uint16_t, 1 > getJumpTableEntrySizeNames()
CVRecord< SymbolKind > CVSymbol
bool symbolEndsScope(SymbolKind Kind)
Return true if this ssymbol ends a scope.
LLVM_ABI EnumStrings< uint16_t, 1 > getLocalFlagNames()
MethodOptions
Equivalent to CV_fldattr_t bitfield.
LLVM_ABI EnumStrings< uint32_t, 1 > getCompileSym3FlagNames()
MemberAccess
Source-level access specifier. (CV_access_e)
bool symbolOpensScope(SymbolKind Kind)
Return true if this symbol opens a scope.
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
LLVM_ABI EnumStrings< SymbolKind, 1 > getSymbolTypeNames()
bool isAggregate(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE,...
LLVM_ABI EnumStrings< uint16_t, 1 > getRegisterNames(CPUType Cpu)
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P section or PDB type stream.
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
LLVM_ABI uint64_t getSizeInBytesForTypeRecord(CVType CVT)
Given an arbitrary codeview type, return the type's size in the case of aggregate (LF_STRUCTURE,...
LLVM_ABI EnumStrings< uint8_t, 1 > getProcSymFlagNames()
LLVM_ABI EnumStrings< TypeLeafKind, 1 > getTypeLeafNames()
LLVM_ABI uint64_t getSizeInBytesForTypeIndex(TypeIndex TI)
Given an arbitrary codeview type index, determine its size.
LLVM_ABI TypeIndex getModifiedType(const CVType &CVT)
Given a CVType which is assumed to be an LF_MODIFIER, return the TypeIndex of the type that the LF_MO...
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration in the Microsoft Debug Interface Access SDK,...
LLVM_ABI void printTypeIndex(ScopedPrinter &Printer, StringRef FieldName, TypeIndex TI, TypeCollection &Types)
StringMapEntry< EmptyStringSetTag > StringEntry
StringEntry keeps data of the string: the length, external offset and a string body which is placed r...
@ DW_INL_declared_inlined
constexpr Tag DW_TAG_unaligned
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
FormattedNumber hexValue(uint64_t N, unsigned Width=HEX_WIDTH, bool Upper=false)
static TypeIndex getTrueType(TypeIndex &TI)
std::vector< TypeIndex > LVLineRecords
std::set< SymbolKind > LVSymbolKinds
static StringRef getRecordName(LazyRandomTypeCollection &Types, TypeIndex TI)
constexpr unsigned int DWARF_CHAR_BIT
LLVM_ABI LVStringRefs getAllLexicalComponents(StringRef Name)
std::vector< StringRef > LVStringRefs
LLVM_ABI std::string transformPath(StringRef Path)
LLVM_ABI LVLexicalComponent getInnerComponent(StringRef Name)
std::tuple< LVStringRefs::size_type, LVStringRefs::size_type > LVLexicalIndex
std::set< TypeLeafKind > LVTypeKinds
SmallVector< LVLine *, 8 > LVLines
LLVM_ABI std::string getScopedName(const LVStringRefs &Components, StringRef BaseName={})
SmallVector< LVLocation *, 8 > LVLocations
@ Parameter
An inlay hint that is for a parameter.
LLVM_ABI std::string formatTypeLeafKind(codeview::TypeLeafKind K)
Print(const T &, const DataFlowGraph &) -> Print< T >
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
std::tuple< uint64_t, uint32_t > InlineSite
LLVM_GET_TYPE_NAME_CONSTEXPR StringRef getTypeName()
We provide a function which tries to compute the (demangled) name of a type statically.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
@ Mod
The access may modify the value stored in memory.
support::detail::RepeatAdapter< T > fmt_repeat(T &&Item, size_t Count)
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
void toHex(ArrayRef< uint8_t > Input, bool LowerCase, SmallVectorImpl< char > &Output)
Convert buffer Input to its hexadecimal representation. The returned string is double the size of Inp...
support::detail::AlignAdapter< T > fmt_align(T &&Item, AlignStyle Where, size_t Amount, char Fill=' ')
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
void consumeError(Error Err)
Consume a Error without doing anything.
DEMANGLE_ABI std::string demangle(std::string_view MangledName)
Attempt to demangle a string using different demangling schemes.
LVShared(LVCodeViewReader *Reader, LVLogicalVisitor *Visitor)
LVLineRecords LineRecords
LVTypeRecords TypeRecords
LVCodeViewReader * Reader
LVLogicalVisitor * Visitor
LVNamespaceDeduction NamespaceDeduction
LVSymbolKinds SymbolKinds
LVStringRecords StringRecords
LVForwardReferences ForwardReferences
A source language supported by any of the debug info representations.