Debug info: Unique types before emitting them to DWARF, where applicable.
authorAdrian Prantl <aprantl@apple.com>
Fri, 14 Mar 2014 23:08:29 +0000 (23:08 +0000)
committerAdrian Prantl <aprantl@apple.com>
Fri, 14 Mar 2014 23:08:29 +0000 (23:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203983 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfUnit.cpp
test/Linker/type-unique-odr-a.ll

index 836beb89b45ff07fd0a0890e922aa1c36ec87038..0b72e969d4bf62a05c3e237347584dfab189d8df 100644 (file)
@@ -958,6 +958,9 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
   DIE *ContextDIE = getOrCreateContextDIE(Context);
   assert(ContextDIE);
 
+  // Unique the type. This is a noop if the type has no unique identifier.
+  Ty = DIType(resolve(Ty.getRef()));
+
   DIE *TyDIE = getDIE(Ty);
   if (TyDIE)
     return TyDIE;
index 6edb0c4bbd6723159c54dc4a779522d93fdd48c1..3ab20bfb3237091fdb1d8b14dbf22033b18aa3e3 100644 (file)
 ; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv"
 ; CHECK:      DW_TAG_class_type
 ; CHECK-NEXT:   DW_AT_name {{.*}} "A"
+; CHECK-NOT:  DW_TAG
+; CHECK:      DW_TAG_member
+; CHECK-NEXT:   DW_AT_name {{.*}} "data"
+; CHECK-NOT:  DW_TAG
 ; CHECK:      DW_TAG_subprogram
 ; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv"
 ; CHECK-NEXT:   DW_AT_name {{.*}} "getFoo"