Do not add AT_APPLE_objc_class_extension attribute if @implementation is not seen.

llvm-svn: 131242
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 3519cd1..6def71f 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1242,8 +1242,7 @@
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);
 
   unsigned Flags = 0;
-  if (ID->getFirstClassExtension() || 
-      (ID->getImplementation() && !ID->getImplementation()->ivar_empty()))
+  if (ID->getImplementation())
     Flags |= llvm::DIDescriptor::FlagObjcClassExtension;
 
   llvm::DIType RealDecl =
diff --git a/clang/test/CodeGenObjC/debug-info-class-extension3.m b/clang/test/CodeGenObjC/debug-info-class-extension3.m
new file mode 100644
index 0000000..549a2ad
--- /dev/null
+++ b/clang/test/CodeGenObjC/debug-info-class-extension3.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -masm-verbose -S -g %s -o - | FileCheck %s
+
+// CHECK-NOT: AT_APPLE_objc_class_extension
+
+@interface Foo {} @end
+
+@interface Foo () {
+    int *bar;
+}
+@end
+
+void bar(Foo *fptr) {}