Index: include/llvm/DebugInfo/CodeView/TypeRecord.h =================================================================== --- include/llvm/DebugInfo/CodeView/TypeRecord.h +++ include/llvm/DebugInfo/CodeView/TypeRecord.h @@ -946,6 +946,44 @@ uint32_t LineNumber; }; +// LF_UDT_MOD_SRC_LINE +class UdtModSourceLineRecord : public TypeRecord { +public: + UdtModSourceLineRecord(TypeIndex UDT, TypeIndex SourceFile, + uint32_t LineNumber, uint16_t Module) + : TypeRecord(TypeRecordKind::UdtSourceLine), UDT(UDT), + SourceFile(SourceFile), LineNumber(LineNumber), Module(Module) {} + + bool remapTypeIndices(ArrayRef IndexMap); + + static ErrorOr deserialize(TypeRecordKind Kind, + ArrayRef &Data) { + const Layout *L = nullptr; + CV_DESERIALIZE(Data, L); + + return UdtModSourceLineRecord(L->UDT, L->SourceFile, L->LineNumber, + L->Module); + } + + TypeIndex getUDT() const { return UDT; } + TypeIndex getSourceFile() const { return SourceFile; } + uint32_t getLineNumber() const { return LineNumber; } + uint16_t getModule() const { return Module; } + +private: + struct Layout { + TypeIndex UDT; // The user-defined type + TypeIndex SourceFile; // StringID containing the source filename + ulittle32_t LineNumber; + ulittle16_t Module; // Module that contributes this UDT definition + }; + + TypeIndex UDT; + TypeIndex SourceFile; + uint32_t LineNumber; + uint16_t Module; +}; + // LF_BUILDINFO class BuildInfoRecord : public TypeRecord { public: Index: include/llvm/DebugInfo/CodeView/TypeRecords.def =================================================================== --- include/llvm/DebugInfo/CodeView/TypeRecords.def +++ include/llvm/DebugInfo/CodeView/TypeRecords.def @@ -81,6 +81,7 @@ TYPE_RECORD_ALIAS(LF_SUBSTR_LIST, 0x1604, StringList, ArgList) TYPE_RECORD(LF_STRING_ID, 0x1605, StringId) TYPE_RECORD(LF_UDT_SRC_LINE, 0x1606, UdtSourceLine) +TYPE_RECORD(LF_UDT_MOD_SRC_LINE, 0x1607, UdtModSourceLine) TYPE_RECORD(LF_METHODLIST, 0x1206, MethodOverloadList) @@ -194,10 +195,6 @@ CV_TYPE(LF_VECTOR, 0x151b) CV_TYPE(LF_MATRIX, 0x151c) -// ID leaf records. Subsequent leaf types may be referenced from .debug$S. - -CV_TYPE(LF_UDT_MOD_SRC_LINE, 0x1607) - // Numeric leaf types. These are generally contained in other records, and not // encountered in the main type stream. Index: include/llvm/DebugInfo/CodeView/TypeTableBuilder.h =================================================================== --- include/llvm/DebugInfo/CodeView/TypeTableBuilder.h +++ include/llvm/DebugInfo/CodeView/TypeTableBuilder.h @@ -51,6 +51,7 @@ TypeIndex writeStringId(const StringIdRecord &Record); TypeIndex writeVFTable(const VFTableRecord &Record); TypeIndex writeUdtSourceLine(const UdtSourceLineRecord &Record); + TypeIndex writeUdtModSourceLine(const UdtModSourceLineRecord &Record); TypeIndex writeFuncId(const FuncIdRecord &Record); TypeIndex writeMemberFuncId(const MemberFuncIdRecord &Record); TypeIndex writeBuildInfo(const BuildInfoRecord &Record); Index: lib/DebugInfo/CodeView/TypeDumper.cpp =================================================================== --- lib/DebugInfo/CodeView/TypeDumper.cpp +++ lib/DebugInfo/CodeView/TypeDumper.cpp @@ -514,6 +514,14 @@ W.printNumber("LineNumber", Line.getLineNumber()); } +void CVTypeDumperImpl::visitUdtModSourceLine(TypeLeafKind Leaf, + UdtModSourceLineRecord &Line) { + printTypeIndex("UDT", Line.getUDT()); + printTypeIndex("SourceFile", Line.getSourceFile()); + W.printNumber("LineNumber", Line.getLineNumber()); + W.printNumber("Module", Line.getModule()); +} + void CVTypeDumperImpl::visitBuildInfo(TypeLeafKind Leaf, BuildInfoRecord &Args) { W.printNumber("NumArgs", static_cast(Args.getArgs().size())); Index: lib/DebugInfo/CodeView/TypeTableBuilder.cpp =================================================================== --- lib/DebugInfo/CodeView/TypeTableBuilder.cpp +++ lib/DebugInfo/CodeView/TypeTableBuilder.cpp @@ -226,6 +226,16 @@ } TypeIndex +TypeTableBuilder::writeUdtModSourceLine(const UdtModSourceLineRecord &Record) { + TypeRecordBuilder Builder(Record.getKind()); + Builder.writeTypeIndex(Record.getUDT()); + Builder.writeTypeIndex(Record.getSourceFile()); + Builder.writeUInt32(Record.getLineNumber()); + Builder.writeUInt16(Record.getModule()); + return writeRecord(Builder); +} + +TypeIndex TypeTableBuilder::writeFuncId(const FuncIdRecord &Record) { TypeRecordBuilder Builder(Record.getKind()); Builder.writeTypeIndex(Record.getParentScope());