]> granicus.if.org Git - clang/commitdiff
Add test case illustrating special handling of 'SenTestCase' subclasses for the missi...
authorTed Kremenek <kremenek@apple.com>
Fri, 13 Feb 2009 22:26:30 +0000 (22:26 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 13 Feb 2009 22:26:30 +0000 (22:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64494 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/MissingDealloc.m

index c326eab300af22b79ab86a5117efb2ccd3077d25..b06c63d426e392b85a763dfb448bc009868a1840 100644 (file)
@@ -1,6 +1,10 @@
 // RUN: clang -analyze -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s --verify
 typedef signed char BOOL;
-@protocol NSObject  - (BOOL)isEqual:(id)object; @end
+@protocol NSObject
+- (BOOL)isEqual:(id)object;
+- (Class)class;
+@end
+
 @interface NSObject <NSObject> {}
 - (void)dealloc;
 - (id)init;
@@ -83,3 +87,31 @@ IBOutlet NSWindow *window;
     [super dealloc];
 }
 @end
+
+//===------------------------------------------------------------------------===
+// PR 3187: http://llvm.org/bugs/show_bug.cgi?id=3187
+// - Disable the missing -dealloc check for classes that subclass SenTestCase
+
+@class NSString;
+
+@interface SenTestCase : NSObject {}
+@end
+
+@interface MyClassTest : SenTestCase {
+  NSString *resourcePath;
+}
+@end
+
+@interface NSBundle : NSObject {}
++ (NSBundle *)bundleForClass:(Class)aClass;
+- (NSString *)resourcePath;
+@end
+
+@implementation MyClassTest
+- (void)setUp {
+  resourcePath = [[NSBundle bundleForClass:[self class]] resourcePath];
+}
+- (void)testXXX {
+  // do something which uses resourcepath
+}
+@end