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
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)
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();
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());
}
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);
}
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); }));
; 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: }
}
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) {