Debug Info: Fix for break due to r181271
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 7 May 2013 17:57:13 +0000 (17:57 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 7 May 2013 17:57:13 +0000 (17:57 +0000)
Apparently we didn't keep an association of Compile Unit metadata nodes
to DIEs so looking up that parental context failed & thus caused no
DW_TAG_imported_modules to be emitted at the CU scope. Fix this by
adding the mapping & sure up the test case to verify this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181339 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/namespace.ll

index aeaa63f2af51c58fa209f181ebf7a9fb6a1c5bd4..90dceacb798bcba1439f84f3d3034995db034730 100644 (file)
@@ -685,6 +685,7 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
   CompileUnit *NewCU = new CompileUnit(GlobalCUIndexCount++,
                                        DIUnit.getLanguage(), Die, Asm,
                                        this, &InfoHolder);
+  NewCU->insertDIE(N, Die);
 
   FileIDCUMap[NewCU->getUniqueID()] = 0;
   // Call this to emit a .file directive if it wasn't emitted for the source
index a7dcf7c6150ec169be21e13a63e6567ef1b75776..3d2a61101856802cde89dc80f4938594ec09c776 100644 (file)
@@ -23,6 +23,8 @@
 ; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F1]])
 ; CHECK-NEXT: DW_AT_decl_line{{.*}}(0x04)
 ; CHECK-NEXT: DW_AT_import{{.*}}=> {[[NS2]]})
+; CHECK: NULL
+; CHECK-NOT: NULL
 
 ; CHECK: DW_TAG_subprogram
 ; CHECK-NEXT: DW_AT_MIPS_linkage_name
 ; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F2]])
 ; CHECK-NEXT: DW_AT_decl_line{{.*}}(0x0b)
 ; CHECK-NEXT: DW_AT_import{{.*}}=> {[[NS2]]})
+; CHECK: NULL
+; CHECK: NULL
+; CHECK-NOT: NULL
+
+; CHECK: DW_TAG_imported_module
+; Same bug as above, this should be F2, not F1
+; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F1]])
+; CHECK-NEXT: DW_AT_decl_line{{.*}}(0x07)
+; CHECK-NEXT: DW_AT_import{{.*}}=> {[[NS1]]})
 
 ; CHECK: file_names[  [[F1]]]{{.*}}debug-info-namespace.cpp
 ; CHECK: file_names[  [[F2]]]{{.*}}foo.cpp