]> granicus.if.org Git - clang/commitdiff
Use DW_AT_APPLE_objc_class_extension attribute to identify interfaces that represent...
authorDevang Patel <dpatel@apple.com>
Thu, 12 May 2011 19:07:41 +0000 (19:07 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 12 May 2011 19:07:41 +0000 (19:07 +0000)
Radar 9423077.

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

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenObjC/debug-info-class-extension.m [new file with mode: 0644]
test/CodeGenObjC/debug-info-class-extension2.m [new file with mode: 0644]

index 3c411f4ffeddf1927e033729804720639711ac52..3519cd1f385a66a27a365209a68066a7476483aa 100644 (file)
@@ -1241,9 +1241,14 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);
 
+  unsigned Flags = 0;
+  if (ID->getFirstClassExtension() || 
+      (ID->getImplementation() && !ID->getImplementation()->ivar_empty()))
+    Flags |= llvm::DIDescriptor::FlagObjcClassExtension;
+
   llvm::DIType RealDecl =
     DBuilder.createStructType(Unit, ID->getName(), DefUnit,
-                                  Line, Size, Align, 0,
+                                  Line, Size, Align, Flags,
                                   Elements, RuntimeLang);
 
   // Now that we have a real decl for the struct, replace anything using the
diff --git a/test/CodeGenObjC/debug-info-class-extension.m b/test/CodeGenObjC/debug-info-class-extension.m
new file mode 100644 (file)
index 0000000..48e6f50
--- /dev/null
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -masm-verbose -S -g %s -o - | FileCheck %s
+
+// CHECK: AT_APPLE_objc_class_extension
+
+@interface I1
+@end
+
+@implementation I1 {
+int myi2;
+}
+int myi;
+@end
+
+void foo(I1 *iptr) {}
+
diff --git a/test/CodeGenObjC/debug-info-class-extension2.m b/test/CodeGenObjC/debug-info-class-extension2.m
new file mode 100644 (file)
index 0000000..6b1a7f1
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1  -fobjc-nonfragile-abi -masm-verbose -S -g %s -o - | FileCheck %s
+// CHECK: AT_APPLE_objc_class_extension
+
+@interface Foo {} @end
+
+@interface Foo () {
+    int *bar;
+}
+@end
+
+@implementation Foo
+@end
+
+void bar(Foo *fptr) {}