]> granicus.if.org Git - clang/commitdiff
Update debug info generation for ObjCObjectPointer changes.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 14 Jul 2009 01:20:56 +0000 (01:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 14 Jul 2009 01:20:56 +0000 (01:20 +0000)
 - 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75582 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h
test/CodeGenObjC/debug-info.m

index 3d7417df30e9e1d25327f9da1a8254d99faba641..0344f562a7b9f5b9bf203eaa0f3a742938c19281 100644 (file)
@@ -200,6 +200,19 @@ llvm::DIType CGDebugInfo::CreateCVRType(QualType Ty, llvm::DICompileUnit Unit) {
                                         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 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
   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);
index de655800fa080018b2dd20857ceb0b098e9278c6..ac28e5b879ed5820046cd8be36500894b2c72c94 100644 (file)
@@ -56,6 +56,8 @@ class CGDebugInfo {
   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);
index 9c461ba68fb4c744e41ff9c6550a7a3733d5645e..519706be7966d8ceb3aca25d587e252044bc6746 100644 (file)
 @implementation A // Line 15
 -(void) m0 {}
 @end
+
+@interface I1 {
+  I1 *iv0;
+}
+@end
+void f0(void) {
+  I1 *x;
+}