[cfe-commits] r75582 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGenObjC/debug-info.m

Daniel Dunbar daniel at zuster.org
Mon Jul 13 18:20:56 PDT 2009


Author: ddunbar
Date: Mon Jul 13 20:20:56 2009
New Revision: 75582

URL: http://llvm.org/viewvc/llvm-project?rev=75582&view=rev
Log:
Update debug info generation for ObjCObjectPointer changes.
 - Previously this would crash on recursive types, and it was also incorrectly
   stripping off a level of indirection.
 - I'm not 100% convinced this is all correct, but it should be a monotonic
   improvment.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h
    cfe/trunk/test/CodeGenObjC/debug-info.m

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=75582&r1=75581&r2=75582&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jul 13 20:20:56 2009
@@ -200,6 +200,19 @@
                                         0, 0, 0, 0, 0, FromTy);
 }
 
+llvm::DIType CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty,
+                                     llvm::DICompileUnit Unit) {
+  llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit);
+ 
+  // Bit size, align and offset of the type.
+  uint64_t Size = M->getContext().getTypeSize(Ty);
+  uint64_t Align = M->getContext().getTypeAlign(Ty);
+                                                                               
+  return DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type, Unit,
+                                        "", llvm::DICompileUnit(),
+                                        0, Size, Align, 0, 0, EltTy);
+}
+
 llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty,
                                      llvm::DICompileUnit Unit) {
   llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit);
@@ -764,11 +777,8 @@
   case Type::QualifiedName:
     // Unsupported types
     return llvm::DIType();
-  case Type::ObjCObjectPointer:   // Encode id<p> in debug info just like id.
-    {
-    ObjCObjectPointerType *OPT = cast<ObjCObjectPointerType>(Ty);
-    return Slot = CreateType(OPT->getInterfaceType(), Unit);
-    }
+  case Type::ObjCObjectPointer:
+    return Slot = CreateType(cast<ObjCObjectPointerType>(Ty), Unit);
   case Type::ObjCQualifiedInterface:  // Drop protocols from interface.
   case Type::ObjCInterface: 
     return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=75582&r1=75581&r2=75582&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Mon Jul 13 20:20:56 2009
@@ -56,6 +56,8 @@
   llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
+  llvm::DIType CreateType(const ObjCObjectPointerType *Ty, 
+                          llvm::DICompileUnit Unit);
   llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const FunctionType *Ty, llvm::DICompileUnit U);

Modified: cfe/trunk/test/CodeGenObjC/debug-info.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info.m?rev=75582&r1=75581&r2=75582&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info.m Mon Jul 13 20:20:56 2009
@@ -16,3 +16,11 @@
 @implementation A // Line 15
 -(void) m0 {}
 @end
+
+ at interface I1 {
+  I1 *iv0;
+}
+ at end
+void f0(void) {
+  I1 *x;
+}





More information about the cfe-commits mailing list