Fix PR14474: don't emit debug info for interface types in -gline-tables-only mode.
authorAlexey Samsonov <samsonov@google.com>
Mon, 3 Dec 2012 18:28:12 +0000 (18:28 +0000)
committerAlexey Samsonov <samsonov@google.com>
Mon, 3 Dec 2012 18:28:12 +0000 (18:28 +0000)
llvm-svn: 169138

clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm [new file with mode: 0644]

index 17972e2..deeda43 100644 (file)
@@ -2691,9 +2691,9 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
     ObjCRuntime->GenerateClass(OMD);
     // Emit global variable debug information.
     if (CGDebugInfo *DI = getModuleDebugInfo())
-      DI->getOrCreateInterfaceType(getContext().getObjCInterfaceType(OMD->getClassInterface()),
-                                  OMD->getLocation());
-    
+      if (getCodeGenOpts().getDebugInfo() >= CodeGenOptions::LimitedDebugInfo)
+        DI->getOrCreateInterfaceType(getContext().getObjCInterfaceType(
+            OMD->getClassInterface()), OMD->getLocation());
     break;
   }
   case Decl::ObjCMethod: {
diff --git a/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm b/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm
new file mode 100644 (file)
index 0000000..e927ab9
--- /dev/null
@@ -0,0 +1,25 @@
+// PR 14474
+// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \
+// RUN:   -gline-tables-only -x objective-c++ -o /dev/null %s
+
+typedef signed char BOOL;
+@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+@protocol NSObject - (BOOL)isEqual:(id)object;
+@end
+@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;
+@end 
+@interface NSObject <NSObject> { }
+@end    
+@interface NSResponder : NSObject <NSCoding> { }
+@end
+@protocol NSValidatedUserInterfaceItem - (SEL)action;
+@end
+@protocol NSUserInterfaceValidations - (BOOL)validateUserInterfaceItem:(id
+<NSValidatedUserInterfaceItem>)anItem;
+@end
+@interface NSRunningApplication : NSObject { }
+@end
+@interface NSApplication : NSResponder <NSUserInterfaceValidations> { }
+@end
+@implementation MockCrApp + (NSApplication*)sharedApplication { }
+@end