[cfe-commits] r154481 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CodeGenModule.cpp test/CodeGenObjC/debug-info-block-helper.m test/CodeGenObjC/debug-info-impl.m test/CodeGenObjC/debug-info-pubtypes.m test/CodeGenObjC/debug-info-synthesis.m

Eric Christopher echristo at apple.com
Tue Apr 10 22:56:05 PDT 2012


Author: echristo
Date: Wed Apr 11 00:56:05 2012
New Revision: 154481

URL: http://llvm.org/viewvc/llvm-project?rev=154481&view=rev
Log:
Enable debug info for objective c implementations that may not have
an explicit instance variable.

rdar://10590352

Added:
    cfe/trunk/test/CodeGenObjC/debug-info-impl.m
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m
    cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m
    cfe/trunk/test/CodeGenObjC/debug-info-synthesis.m

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=154481&r1=154480&r2=154481&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Apr 11 00:56:05 2012
@@ -1181,6 +1181,15 @@
   return T;
 }
 
+/// getOrCreateInterfaceType - Emit an objective c interface type standalone
+/// debug info.
+llvm::DIType CGDebugInfo::getOrCreateInterfaceType(QualType D,
+						   SourceLocation Loc) {
+  llvm::DIType T = getOrCreateType(D, getOrCreateFile(Loc));
+  DBuilder.retainType(T);
+  return T;
+}
+
 /// CreateType - get structure or union type.
 llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
   RecordDecl *RD = Ty->getDecl();
@@ -1282,6 +1291,7 @@
 				 RuntimeLang);
     return FwdDecl;
   }
+
   ID = Def;
 
   // Bit size, align and offset of the type.
@@ -1296,7 +1306,7 @@
     DBuilder.createStructType(Unit, ID->getName(), DefUnit,
                               Line, Size, Align, Flags,
                               llvm::DIArray(), RuntimeLang);
-  
+
   // Otherwise, insert it into the CompletedTypeCache so that recursive uses
   // will find it and we're emitting the complete type.
   CompletedTypeCache[QualType(Ty, 0).getAsOpaquePtr()] = RealDecl;

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=154481&r1=154480&r2=154481&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Apr 11 00:56:05 2012
@@ -226,6 +226,12 @@
 
   /// getOrCreateRecordType - Emit record type's standalone debug info. 
   llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L);
+
+  /// getOrCreateInterfaceType - Emit an objective c interface type standalone
+  /// debug info.
+  llvm::DIType getOrCreateInterfaceType(QualType Ty,
+					SourceLocation Loc);
+
 private:
   /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
   void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI,

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=154481&r1=154480&r2=154481&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Apr 11 00:56:05 2012
@@ -2535,6 +2535,11 @@
     EmitObjCPropertyImplementations(OMD);
     EmitObjCIvarInitializations(OMD);
     ObjCRuntime->GenerateClass(OMD);
+    // Emit global variable debug information.
+    if (CGDebugInfo *DI = getModuleDebugInfo())
+      DI->getOrCreateInterfaceType(getContext().getObjCInterfaceType(OMD->getClassInterface()),
+				   OMD->getLocation());
+    
     break;
   }
   case Decl::ObjCMethod: {

Modified: cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m?rev=154481&r1=154480&r2=154481&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m Wed Apr 11 00:56:05 2012
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s -o - | FileCheck %s
 extern void foo(void(^)(void));
 
-// CHECK: !40 = metadata !{i32 {{.*}}, i32 0, metadata !25, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !25, i32 24, metadata !41, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !43, i32 24} ; [ DW_TAG_subprogram ]
+// CHECK: !42 = metadata !{i32 {{.*}}, i32 0, metadata !27, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !27, i32 24, metadata !43, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !45, i32 24} ; [ DW_TAG_subprogram ]
 
 @interface NSObject {
   struct objc_object *isa;

Added: cfe/trunk/test/CodeGenObjC/debug-info-impl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-impl.m?rev=154481&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-impl.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-impl.m Wed Apr 11 00:56:05 2012
@@ -0,0 +1,16 @@
+// RUN: %clang -fverbose-asm -g -S -emit-llvm %s -o - | FileCheck %s
+// CHECK: metadata !{i32 786451, metadata !6, metadata !"Circle", metadata !6, i32 11, i64 64, i64 64, i32 0, i32 512, null, metadata !7, i32 16, i32 0} ; [ DW_TAG_structure_type ]
+ at interface NSObject {
+  struct objc_object *isa;
+}
+ at end
+
+ at interface Shape : NSObject
+
+ at end
+ at interface Circle : Shape
+
+ at end
+ at implementation Circle
+
+ at end

Modified: cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m?rev=154481&r1=154480&r2=154481&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m Wed Apr 11 00:56:05 2012
@@ -1,7 +1,7 @@
 // REQUIRES: x86-64-registered-target
 // RUN: %clang -cc1 -triple x86_64-apple-darwin10 -g -emit-llvm %s -o - | FileCheck %s
 
-// CHECK: !10 = metadata !{i32 {{.*}}, metadata !6, metadata !"H", metadata !6, i32 6, i64 0, i64 8, i32 0, i32 512, null, metadata !2, i32 16, i32 0} ; [ DW_TAG_structure_type ]
+// CHECK: !5 = metadata !{i32 {{.*}}, metadata !6, metadata !"H", metadata !6, i32 6, i64 0, i64 8, i32 0, i32 512, null, metadata !2, i32 16, i32 0} ; [ DW_TAG_structure_type ]
 
 @interface H
 -(void) foo;

Modified: cfe/trunk/test/CodeGenObjC/debug-info-synthesis.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-synthesis.m?rev=154481&r1=154480&r2=154481&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-synthesis.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-synthesis.m Wed Apr 11 00:56:05 2012
@@ -30,5 +30,5 @@
   }
 }
 
-// CHECK: !11 = metadata !{i32 {{.*}}, metadata !"./foo.h"
-// CHECK: !29 = metadata !{i32 {{.*}}, i32 0, metadata !11, metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata !11, i32 8, metadata !30, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !32, i32 8} ; [ DW_TAG_subprogram ]
+// CHECK: !7 = metadata !{i32 {{.*}}, metadata !"./foo.h"
+// CHECK: !31 = metadata !{i32 {{.*}}, i32 0, metadata !7, metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata !7, i32 8, metadata !32, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !34, i32 8} ; [ DW_TAG_subprogram ]





More information about the cfe-commits mailing list