summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp5
-rw-r--r--test/DebugInfo/X86/generate-odr-hash.ll2
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index e4188c39b0..24beebbd35 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -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) {
diff --git a/test/DebugInfo/X86/generate-odr-hash.ll b/test/DebugInfo/X86/generate-odr-hash.ll
index 2ccbc98d5e..74c1699ef8 100644
--- a/test/DebugInfo/X86/generate-odr-hash.ll
+++ b/test/DebugInfo/X86/generate-odr-hash.ll
@@ -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.