[cfe-commits] r167336 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-class.cpp test/CodeGenCXX/debug-info-fwd-ref.cpp

David Blaikie dblaikie at gmail.com
Fri Nov 2 16:40:00 PDT 2012


Author: dblaikie
Date: Fri Nov  2 18:40:00 2012
New Revision: 167336

URL: http://llvm.org/viewvc/llvm-project?rev=167336&view=rev
Log:
Emit debug info for C++ struct definitions as DW_TAG_structure_type (instead of class_type).

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-class.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-fwd-ref.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=167336&r1=167335&r2=167336&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Nov  2 18:40:00 2012
@@ -1875,7 +1875,7 @@
   // Get overall information about the record type for the debug info.
   llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation());
   unsigned Line = getLineNumber(RD->getLocation());
-  StringRef RDName = RD->getName();
+  StringRef RDName = getClassName(RD);
 
   llvm::DIDescriptor RDContext;
   if (CGM.getCodeGenOpts().getDebugInfo() == CodeGenOptions::LimitedDebugInfo)
@@ -1896,9 +1896,7 @@
   if (RD->isUnion())
     RealDecl = DBuilder.createUnionType(RDContext, RDName, DefUnit, Line,
 					Size, Align, 0, llvm::DIArray());
-  else if (CXXDecl) {
-    RDName = getClassName(RD);
-    
+  else if (RD->isClass()) {
     // FIXME: This could be a struct type giving a default visibility different
     // than C++ class type, but needs llvm metadata changes first.
     RealDecl = DBuilder.createClassType(RDContext, RDName, DefUnit, Line,

Modified: cfe/trunk/test/CodeGenCXX/debug-info-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class.cpp?rev=167336&r1=167335&r2=167336&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-class.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class.cpp Fri Nov  2 18:40:00 2012
@@ -8,7 +8,7 @@
 union baz;
 void func(baz *f) { // CHECK: DW_TAG_union_type
 }
-struct A { // FIXME: we're still emitting this as DW_TAG_class_type
+struct A { // CHECK: DW_TAG_structure_type
   int one;
   static const int HdrSize = 52; // CHECK: HdrSize
   int two;

Modified: cfe/trunk/test/CodeGenCXX/debug-info-fwd-ref.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-fwd-ref.cpp?rev=167336&r1=167335&r2=167336&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-fwd-ref.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-fwd-ref.cpp Fri Nov  2 18:40:00 2012
@@ -16,11 +16,10 @@
     return 0;
 }
 
-// Make sure we have two DW_TAG_class_types for baz and bar and no forward
+// Make sure we have two DW_TAG_structure_types for baz and bar and no forward
 // references.
-// FIXME: These should be struct types to match the declaration.
-// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !18, i32 0, null, null} ; [ DW_TAG_class_type ]
-// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !21, i32 0, null, null} ; [ DW_TAG_class_type ]
-// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 0, i32 0} ; [ DW_TAG_class_type ]
-// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null} ; [ DW_TAG_class_type ]
+// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !18, i32 0, null, null} ; [ DW_TAG_structure_type ]
+// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !21, i32 0, null, null} ; [ DW_TAG_structure_type ]
+// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 0, i32 0} ; [ DW_TAG_structure_type ]
+// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null} ; [ DW_TAG_structure_type ]
 





More information about the cfe-commits mailing list