[PATCH] D44116: [CodeView] Emit UdtSourceLine information for enums

Aaron Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 13:15:59 PST 2018


asmith created this revision.
asmith added reviewers: zturner, llvm-commits.

- Emit UdtSourceLine information for enums to match MSVC
- Update test cases to verify the changes


Repository:
  rL LLVM

https://reviews.llvm.org/D44116

Files:
  lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  test/DebugInfo/COFF/enum.ll
  test/DebugInfo/COFF/nested-types.ll


Index: test/DebugInfo/COFF/nested-types.ll
===================================================================
--- test/DebugInfo/COFF/nested-types.ll
+++ test/DebugInfo/COFF/nested-types.ll
@@ -134,7 +134,7 @@
 ; CHECK-NEXT:   }
 ; CHECK-NEXT: }
 ;
-; CHECK:      Struct (0x1007) {
+; CHECK:      Struct (0x{{.*}}) {
 ; CHECK-NEXT:   TypeLeafKind: LF_STRUCTURE (0x1505)
 ; CHECK-NEXT:   MemberCount: 4
 ; CHECK-NEXT:   Properties [ (0x210)
Index: test/DebugInfo/COFF/enum.ll
===================================================================
--- test/DebugInfo/COFF/enum.ll
+++ test/DebugInfo/COFF/enum.ll
@@ -23,6 +23,17 @@
 ; CHECK-NEXT:    FieldListType: <field list> (0x1000)
 ; CHECK-NEXT:    Name: E
 ; CHECK-NEXT:  }
+; CHECK-NEXT:  StringId (0x1002) {
+; CHECK-NEXT:    TypeLeafKind: LF_STRING_ID (0x1605)
+; CHECK-NEXT:    Id: 0x0
+; CHECK-NEXT:    StringData: \<stdin>
+; CHECK-NEXT:  }
+; CHECK-NEXT:  UdtSourceLine (0x1003) {
+; CHECK-NEXT:    TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
+; CHECK-NEXT:    UDT: E (0x1001)
+; CHECK-NEXT:    SourceFile: \<stdin> (0x1002)
+; CHECK-NEXT:    LineNumber: 1
+; CHECK_NEXT  }
 
 source_filename = "test/DebugInfo/COFF/enum.ll"
 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
Index: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -1765,7 +1765,14 @@
 
   EnumRecord ER(EnumeratorCount, CO, FTI, FullName, Ty->getIdentifier(),
                 getTypeIndex(Ty->getBaseType()));
-  return TypeTable.writeLeafType(ER);
+  TypeIndex EnumTI = TypeTable.writeLeafType(ER);
+
+  StringIdRecord SIR(TypeIndex(0x0), getFullFilepath(Ty->getFile()));
+  TypeIndex SIRI = TypeTable.writeLeafType(SIR);
+  UdtSourceLineRecord USLR(EnumTI, SIRI, Ty->getLine());
+  TypeTable.writeLeafType(USLR);
+
+  return EnumTI;
 }
 
 //===----------------------------------------------------------------------===//


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44116.137067.patch
Type: text/x-patch
Size: 2018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180305/4208ec43/attachment.bin>


More information about the llvm-commits mailing list