diff options
-rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h | 19 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def | 4 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeDatabaseVisitor.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeRecord.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp | 9 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-headers.test | 6 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbdump/YamlTypeDumper.cpp | 6 |
8 files changed, 70 insertions, 8 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h index 0b7c41d864a..64e30af908a 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h @@ -236,12 +236,29 @@ public: StringRef Name; }; -// LF_ARGLIST, LF_SUBSTR_LIST +// LF_ARGLIST class ArgListRecord : public TypeRecord { public: explicit ArgListRecord(TypeRecordKind Kind) : TypeRecord(Kind) {} ArgListRecord(TypeRecordKind Kind, ArrayRef<TypeIndex> Indices) + : TypeRecord(Kind), ArgIndices(Indices) {} + + /// Rewrite member type indices with IndexMap. Returns false if a type index + /// is not in the map. + bool remapTypeIndices(ArrayRef<TypeIndex> IndexMap); + + ArrayRef<TypeIndex> getIndices() const { return ArgIndices; } + + std::vector<TypeIndex> ArgIndices; +}; + +// LF_SUBSTR_LIST +class StringListRecord : public TypeRecord { +public: + explicit StringListRecord(TypeRecordKind Kind) : TypeRecord(Kind) {} + + StringListRecord(TypeRecordKind Kind, ArrayRef<TypeIndex> Indices) : TypeRecord(Kind), StringIndices(Indices) {} /// Rewrite member type indices with IndexMap. Returns false if a type index diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def b/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def index c98dbac21a7..1ca061d0ac1 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def @@ -79,9 +79,7 @@ MEMBER_RECORD(LF_INDEX, 0x1404, ListContinuation) TYPE_RECORD(LF_FUNC_ID, 0x1601, FuncId) TYPE_RECORD(LF_MFUNC_ID, 0x1602, MemberFuncId) TYPE_RECORD(LF_BUILDINFO, 0x1603, BuildInfo) -// FIXME: We reuse the structure of ArgListRecord for substring lists, but it -// makes for confusing dumper output. -TYPE_RECORD_ALIAS(LF_SUBSTR_LIST, 0x1604, StringList, ArgList) +TYPE_RECORD(LF_SUBSTR_LIST, 0x1604, StringList) TYPE_RECORD(LF_STRING_ID, 0x1605, StringId) TYPE_RECORD(LF_UDT_SRC_LINE, 0x1606, UdtSourceLine) TYPE_RECORD(LF_UDT_MOD_SRC_LINE, 0x1607, UdtModSourceLine) diff --git a/llvm/lib/DebugInfo/CodeView/TypeDatabaseVisitor.cpp b/llvm/lib/DebugInfo/CodeView/TypeDatabaseVisitor.cpp index d9d56390218..4c56ab03644 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDatabaseVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDatabaseVisitor.cpp @@ -83,6 +83,22 @@ Error TypeDatabaseVisitor::visitKnownRecord(CVType &CVR, ArgListRecord &Args) { return Error::success(); } +Error TypeDatabaseVisitor::visitKnownRecord(CVType &CVR, + StringListRecord &Strings) { + auto Indices = Strings.getIndices(); + uint32_t Size = Indices.size(); + SmallString<256> TypeName("\""); + for (uint32_t I = 0; I < Size; ++I) { + StringRef ArgTypeName = TypeDB.getTypeName(Indices[I]); + TypeName.append(ArgTypeName); + if (I + 1 != Size) + TypeName.append("\" \""); + } + TypeName.push_back('\"'); + Name = TypeDB.saveTypeName(TypeName); + return Error::success(); +} + Error TypeDatabaseVisitor::visitKnownRecord(CVType &CVR, ClassRecord &Class) { Name = Class.getName(); return Error::success(); diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp index 636985b7899..d4d03482419 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp @@ -228,6 +228,17 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ArgListRecord &Args) { return Error::success(); } +Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, StringListRecord &Strs) { + auto Indices = Strs.getIndices(); + uint32_t Size = Indices.size(); + W->printNumber("NumStrings", Size); + ListScope Arguments(*W, "Strings"); + for (uint32_t I = 0; I < Size; ++I) { + printTypeIndex("String", Indices[I]); + } + return Error::success(); +} + Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ClassRecord &Class) { uint16_t Props = static_cast<uint16_t>(Class.getOptions()); W->printNumber("MemberCount", Class.getMemberCount()); diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp index 386694a611a..6482f291898 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp @@ -65,6 +65,13 @@ bool MemberFuncIdRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) { bool ArgListRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) { bool Success = true; + for (TypeIndex &Arg : ArgIndices) + Success &= remapIndex(IndexMap, Arg); + return Success; +} + +bool StringListRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) { + bool Success = true; for (TypeIndex &Str : StringIndices) Success &= remapIndex(IndexMap, Str); return Success; diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp index 2e1ee978f47..a81caed8a37 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp @@ -171,6 +171,15 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ArgListRecord &Record) { error(IO.mapVectorN<uint32_t>( + Record.ArgIndices, + [](CodeViewRecordIO &IO, TypeIndex &N) { return IO.mapInteger(N); })); + + return Error::success(); +} + +Error TypeRecordMapping::visitKnownRecord(CVType &CVR, + StringListRecord &Record) { + error(IO.mapVectorN<uint32_t>( Record.StringIndices, [](CodeViewRecordIO &IO, TypeIndex &N) { return IO.mapInteger(N); })); diff --git a/llvm/test/DebugInfo/PDB/pdbdump-headers.test b/llvm/test/DebugInfo/PDB/pdbdump-headers.test index c10d866f4a8..ec661344a84 100644 --- a/llvm/test/DebugInfo/PDB/pdbdump-headers.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-headers.test @@ -1111,9 +1111,9 @@ ; ALL: { ; ALL: StringList (0x1057) { ; ALL: TypeLeafKind: LF_SUBSTR_LIST (0x1604) -; ALL: NumArgs: 1 -; ALL: Arguments [ -; ALL: ArgType: __vc_attributes::threadingAttribute (0x100B) +; ALL: NumStrings: 1 +; ALL: Strings [ +; ALL: String: __vc_attributes::threadingAttribute (0x100B) ; ALL: ] ; ALL: } ; ALL: } diff --git a/llvm/tools/llvm-pdbdump/YamlTypeDumper.cpp b/llvm/tools/llvm-pdbdump/YamlTypeDumper.cpp index e2b901be868..c7ad02b746e 100644 --- a/llvm/tools/llvm-pdbdump/YamlTypeDumper.cpp +++ b/llvm/tools/llvm-pdbdump/YamlTypeDumper.cpp @@ -291,7 +291,11 @@ void MappingTraits<StringIdRecord>::mapping(IO &IO, StringIdRecord &String) { } void MappingTraits<ArgListRecord>::mapping(IO &IO, ArgListRecord &Args) { - IO.mapRequired("ArgIndices", Args.StringIndices); + IO.mapRequired("ArgIndices", Args.ArgIndices); +} + +void MappingTraits<StringListRecord>::mapping(IO &IO, StringListRecord &Strings) { + IO.mapRequired("StringIndices", Strings.StringIndices); } void MappingTraits<ClassRecord>::mapping(IO &IO, ClassRecord &Class) { |