[cfe-commits] r52993 - /cfe/trunk/test/Analysis/NSPanel.m
Ted Kremenek
kremenek at apple.com
Tue Jul 1 16:29:52 PDT 2008
Author: kremenek
Date: Tue Jul 1 18:29:51 2008
New Revision: 52993
URL: http://llvm.org/viewvc/llvm-project?rev=52993&view=rev
Log:
Added reference count checker test case.
Added:
cfe/trunk/test/Analysis/NSPanel.m
Added: cfe/trunk/test/Analysis/NSPanel.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NSPanel.m?rev=52993&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/NSPanel.m (added)
+++ cfe/trunk/test/Analysis/NSPanel.m Tue Jul 1 18:29:51 2008
@@ -0,0 +1,86 @@
+// RUN: clang -checker-cfref -verify %s
+
+// BEGIN delta-debugging reduced header stuff
+
+typedef struct objc_selector *SEL;
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+ at protocol NSObject
+- (BOOL)isEqual:(id)object;
+- (oneway void)release;
+ at end
+ at protocol NSCopying
+- (id)copyWithZone:(NSZone *)zone;
+ at end
+ at protocol NSMutableCopying
+- (id)mutableCopyWithZone:(NSZone *)zone;
+ at end
+ at protocol NSCoding
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+ at end
+ at interface NSObject <NSObject> {}
++ (id)alloc;
+ at end
+typedef float CGFloat;
+typedef struct _NSPoint {} NSRect;
+static __inline__ __attribute__((always_inline)) NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) {}
+typedef struct {} NSFastEnumerationState;
+ at protocol NSFastEnumeration
+- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
+ at end
+ at class NSString;
+ at interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
+- (NSUInteger)count;
+ at end
+ at interface NSMutableArray : NSArray
+- (void)addObject:(id)anObject;
+ at end @class NSAppleEventDescriptor;
+enum { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, NSBackingStoreBuffered = 2 };
+typedef NSUInteger NSBackingStoreType;
+ at interface NSResponder : NSObject <NSCoding> {} @end
+ at protocol NSAnimatablePropertyContainer
+- (id)animator;
+ at end
+ at protocol NSValidatedUserInterfaceItem
+- (SEL)action;
+ at end
+ at protocol NSUserInterfaceValidations
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem;
+ at end @class NSDate, NSDictionary, NSError, NSException, NSNotification;
+enum { NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 << 0, NSClosableWindowMask = 1 << 1, NSMiniaturizableWindowMask = 1 << 2, NSResizableWindowMask = 1 << 3 };
+ at interface NSWindow : NSResponder <NSAnimatablePropertyContainer, NSUserInterfaceValidations> {}
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag;
+ at end
+extern NSString *NSWindowDidBecomeKeyNotification;
+ at interface NSPanel : NSWindow {}
+ at end
+ at class NSTableHeaderView;
+
+// END delta-debugging reduced header stuff
+
+ at interface MyClass
+{
+ NSMutableArray *panels;
+}
+- (void)myMethod;
+- (void)myMethod2;
+ at end
+ at implementation MyClass
+- (void)myMethod
+{
+ NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1];
+
+ [panels addObject:panel];
+
+ [panel release]; // no-warning
+}
+- (void)myMethod2
+{
+ NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1];
+
+ [panel addObject:panel]; // expected-warning{{leak}}
+}
+ at end
+
More information about the cfe-commits
mailing list