summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-06-15 21:25:29 +0000
committerRui Ueyama <ruiu@google.com>2016-06-15 21:25:29 +0000
commit5dbea9db1073796d4e5fc3e1b80eed2215c21c9a (patch)
tree0142bccbbd380dd3c466d37c784075a0bb7db5ab
parent63af1aa0c20689801e6d88d8cae7b76225b6ff5e (diff)
downloadbcm5719-llvm-5dbea9db1073796d4e5fc3e1b80eed2215c21c9a.tar.gz
bcm5719-llvm-5dbea9db1073796d4e5fc3e1b80eed2215c21c9a.zip
[Codeview] Add a class for LF_UDT_MOD_SRC_LINE.
Differential Revision: http://reviews.llvm.org/D21406 llvm-svn: 272843
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h38
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def5
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h1
-rw-r--r--llvm/lib/DebugInfo/CodeView/TypeDumper.cpp8
-rw-r--r--llvm/lib/DebugInfo/CodeView/TypeRecord.cpp7
-rw-r--r--llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp11
-rw-r--r--llvm/test/DebugInfo/PDB/pdbdump-headers.test130
7 files changed, 130 insertions, 70 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 090922d79f1..17f31e12db1 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -767,6 +767,44 @@ private:
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<TypeIndex> IndexMap);
+
+ static ErrorOr<UdtModSourceLineRecord> deserialize(TypeRecordKind Kind,
+ ArrayRef<uint8_t> &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:
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def b/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def
index e2824f1757e..5f10b72c530 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecords.def
@@ -81,6 +81,7 @@ TYPE_RECORD(LF_BUILDINFO, 0x1603, BuildInfo)
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_MODIFIER_EX, 0x1518)
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.
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
index e180390fccf..5b2aa618614 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
@@ -51,6 +51,7 @@ public:
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);
diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp
index 42cb0aa1fd2..3aba50efb87 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp
@@ -514,6 +514,14 @@ void CVTypeDumperImpl::visitUdtSourceLine(TypeLeafKind Leaf,
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<uint32_t>(Args.getArgs().size()));
diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
index bce6ebc337e..cc09abcd988 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
@@ -491,6 +491,13 @@ bool UdtSourceLineRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) {
return Success;
}
+bool UdtModSourceLineRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) {
+ bool Success = true;
+ Success &= remapIndex(IndexMap, UDT);
+ Success &= remapIndex(IndexMap, SourceFile);
+ return Success;
+}
+
bool BuildInfoRecord::remapTypeIndices(ArrayRef<TypeIndex> IndexMap) {
bool Success = true;
for (TypeIndex &Arg : ArgIndices)
diff --git a/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp b/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp
index 13d1ae50069..7ac9581db3f 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeTableBuilder.cpp
@@ -226,7 +226,16 @@ TypeTableBuilder::writeUdtSourceLine(const UdtSourceLineRecord &Record) {
}
TypeIndex
-TypeTableBuilder::writeFuncId(const FuncIdRecord &Record) {
+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());
Builder.writeTypeIndex(Record.getFunctionType());
diff --git a/llvm/test/DebugInfo/PDB/pdbdump-headers.test b/llvm/test/DebugInfo/PDB/pdbdump-headers.test
index 2294da69182..2539f00505e 100644
--- a/llvm/test/DebugInfo/PDB/pdbdump-headers.test
+++ b/llvm/test/DebugInfo/PDB/pdbdump-headers.test
@@ -153,72 +153,72 @@
; EMPTY-NEXT: Record count: 15
; EMPTY-NEXT: Records [
; EMPTY-NEXT: {
-; EMPTY-NEXT: UnknownLeaf (0x104B) {
+; EMPTY-NEXT: UdtModSourceLine (0x104B) {
; EMPTY-NEXT: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: UnknownType {
-; EMPTY-NEXT: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: Length: 16
-; EMPTY-NEXT: }
+; EMPTY-NEXT: UDT: __vc_attributes::threadingAttribute (0x100B)
+; EMPTY-NEXT: SourceFile: <unknown simple type> (0x1)
+; EMPTY-NEXT: LineNumber: 481
+; EMPTY-NEXT: Module: 1
; EMPTY-NEXT: }
; EMPTY-NEXT: Bytes (
; EMPTY-NEXT: 0000: 0B100000 01000000 E1010000 0100F2F1 |................|
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
-; EMPTY-NEXT: UnknownLeaf (0x104C) {
+; EMPTY-NEXT: UdtModSourceLine (0x104C) {
; EMPTY-NEXT: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: UnknownType {
-; EMPTY-NEXT: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: Length: 16
-; EMPTY-NEXT: }
+; EMPTY-NEXT: UDT: __vc_attributes::event_receiverAttribute (0x1017)
+; EMPTY-NEXT: SourceFile: <unknown simple type> (0x1)
+; EMPTY-NEXT: LineNumber: 194
+; EMPTY-NEXT: Module: 1
; EMPTY-NEXT: }
; EMPTY-NEXT: Bytes (
; EMPTY-NEXT: 0000: 17100000 01000000 C2000000 0100F2F1 |................|
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
-; EMPTY-NEXT: UnknownLeaf (0x104D) {
+; EMPTY-NEXT: UdtModSourceLine (0x104D) {
; EMPTY-NEXT: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: UnknownType {
-; EMPTY-NEXT: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: Length: 16
-; EMPTY-NEXT: }
+; EMPTY-NEXT: UDT: __vc_attributes::aggregatableAttribute (0x1021)
+; EMPTY-NEXT: SourceFile: <unknown simple type> (0x1)
+; EMPTY-NEXT: LineNumber: 603
+; EMPTY-NEXT: Module: 1
; EMPTY-NEXT: }
; EMPTY-NEXT: Bytes (
; EMPTY-NEXT: 0000: 21100000 01000000 5B020000 0100F2F1 |!.......[.......|
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
-; EMPTY-NEXT: UnknownLeaf (0x104E) {
+; EMPTY-NEXT: UdtModSourceLine (0x104E) {
; EMPTY-NEXT: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: UnknownType {
-; EMPTY-NEXT: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: Length: 16
-; EMPTY-NEXT: }
+; EMPTY-NEXT: UDT: __vc_attributes::event_sourceAttribute (0x102C)
+; EMPTY-NEXT: SourceFile: <unknown simple type> (0x1)
+; EMPTY-NEXT: LineNumber: 1200
+; EMPTY-NEXT: Module: 1
; EMPTY-NEXT: }
; EMPTY-NEXT: Bytes (
; EMPTY-NEXT: 0000: 2C100000 01000000 B0040000 0100F2F1 |,...............|
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
-; EMPTY-NEXT: UnknownLeaf (0x104F) {
+; EMPTY-NEXT: UdtModSourceLine (0x104F) {
; EMPTY-NEXT: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: UnknownType {
-; EMPTY-NEXT: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: Length: 16
-; EMPTY-NEXT: }
+; EMPTY-NEXT: UDT: __vc_attributes::moduleAttribute (0x103A)
+; EMPTY-NEXT: SourceFile: <unknown simple type> (0x1)
+; EMPTY-NEXT: LineNumber: 540
+; EMPTY-NEXT: Module: 1
; EMPTY-NEXT: }
; EMPTY-NEXT: Bytes (
; EMPTY-NEXT: 0000: 3A100000 01000000 1C020000 0100F2F1 |:...............|
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
-; EMPTY-NEXT: UnknownLeaf (0x1050) {
+; EMPTY-NEXT: UdtModSourceLine (0x1050) {
; EMPTY-NEXT: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: UnknownType {
-; EMPTY-NEXT: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; EMPTY-NEXT: Length: 16
-; EMPTY-NEXT: }
+; EMPTY-NEXT: UDT: __vc_attributes::helper_attributes::usageAttribute (0x1042)
+; EMPTY-NEXT: SourceFile: <unknown simple type> (0x1)
+; EMPTY-NEXT: LineNumber: 108
+; EMPTY-NEXT: Module: 1
; EMPTY-NEXT: }
; EMPTY-NEXT: Bytes (
; EMPTY-NEXT: 0000: 42100000 01000000 6C000000 0100F2F1 |B.......l.......|
@@ -1003,66 +1003,66 @@
; ALL: Record count: 15
; ALL: Records [
; ALL: {
-; ALL: UnknownLeaf (0x104B) {
+; ALL: UdtModSourceLine (0x104B) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::threadingAttribute (0x100B)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 481
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
-; ALL: UnknownLeaf (0x104C) {
+; ALL: UdtModSourceLine (0x104C) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::event_receiverAttribute (0x1017)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 194
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
-; ALL: UnknownLeaf (0x104D) {
+; ALL: UdtModSourceLine (0x104D) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::aggregatableAttribute (0x1021)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 603
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
-; ALL: UnknownLeaf (0x104E) {
+; ALL: UdtModSourceLine (0x104E) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::event_sourceAttribute (0x102C)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 1200
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
-; ALL: UnknownLeaf (0x104F) {
+; ALL: UdtModSourceLine (0x104F) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::moduleAttribute (0x103A)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 540
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
-; ALL: UnknownLeaf (0x1050) {
+; ALL: UdtModSourceLine (0x1050) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::helper_attributes::usageAttribute (0x1042)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 108
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
-; ALL: UnknownLeaf (0x1051) {
+; ALL: UdtModSourceLine (0x1051) {
; ALL: TypeLeafKind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: UnknownType {
-; ALL: Kind: LF_UDT_MOD_SRC_LINE (0x1607)
-; ALL: Length: 16
-; ALL: }
+; ALL: UDT: __vc_attributes::helper_attributes::v1_alttypeAttribute (0x104A)
+; ALL: SourceFile: <unknown simple type> (0x1)
+; ALL: LineNumber: 96
+; ALL: Module: 1
; ALL: }
; ALL: }
; ALL: {
OpenPOWER on IntegriCloud