[llvm] r200569 - DebugInfo: Flag type unit references as declarations

David Blaikie dblaikie at gmail.com
Fri Jan 31 11:52:27 PST 2014


Author: dblaikie
Date: Fri Jan 31 13:52:26 2014
New Revision: 200569

URL: http://llvm.org/viewvc/llvm-project?rev=200569&view=rev
Log:
DebugInfo: Flag type unit references as declarations

This ensures DWARF consumers don't confuse these references for
definitions. I'd argue it might be nice to improve debuggers so we don't
need this, but it's just one field in an abbreviation anyway - so it
doesn't seem worth the fight.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/X86/generate-odr-hash.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=200569&r1=200568&r2=200569&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jan 31 13:52:26 2014
@@ -3016,6 +3016,11 @@ void DwarfDebug::emitDebugStrDWO() {
 void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode,
                                       StringRef Identifier, DIE *RefDie,
                                       DICompositeType CTy) {
+  // Flag the type unit reference as a declaration so that if it contains
+  // members (implicit special members, static data member definitions, member
+  // declarations for definitions in this CU, etc) consumers don't get confused
+  // and think this is a full definition.
+  CUMap.begin()->second->addFlag(RefDie, dwarf::DW_AT_declaration);
 
   const DwarfTypeUnit *&TU = DwarfTypeUnits[CTy];
   if (TU) {

Modified: llvm/trunk/test/DebugInfo/X86/generate-odr-hash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/generate-odr-hash.ll?rev=200569&r1=200568&r2=200569&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/generate-odr-hash.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/generate-odr-hash.ll Fri Jan 31 13:52:26 2014
@@ -51,8 +51,10 @@
 ; CHECK: Compile Unit: length = [[CU_SIZE:[0-9a-f]+]]
 
 ; CHECK: DW_TAG_structure_type
+; CHECK-NEXT: DW_AT_declaration
 ; CHECK-NEXT: DW_AT_signature
 ; CHECK: DW_TAG_class_type
+; CHECK-NEXT: DW_AT_declaration
 ; CHECK-NEXT: DW_AT_signature
 
 ; Ensure the CU-local type 'walrus' is not placed in a type unit.





More information about the llvm-commits mailing list