Ted Kremenek | 8382cf5 | 2009-11-13 18:46:29 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s |
| 2 | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s |
| 3 | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s |
| 4 | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s |
Ted Kremenek | 91d1a14 | 2008-07-01 23:29:51 +0000 | [diff] [blame] | 5 | |
| 6 | // BEGIN delta-debugging reduced header stuff |
| 7 | |
| 8 | typedef struct objc_selector *SEL; |
| 9 | typedef signed char BOOL; |
| 10 | typedef unsigned int NSUInteger; |
| 11 | typedef struct _NSZone NSZone; |
| 12 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 13 | @protocol NSObject |
| 14 | - (BOOL)isEqual:(id)object; |
| 15 | - (oneway void)release; |
| 16 | @end |
| 17 | @protocol NSCopying |
| 18 | - (id)copyWithZone:(NSZone *)zone; |
| 19 | @end |
| 20 | @protocol NSMutableCopying |
| 21 | - (id)mutableCopyWithZone:(NSZone *)zone; |
| 22 | @end |
| 23 | @protocol NSCoding |
| 24 | - (void)encodeWithCoder:(NSCoder *)aCoder; |
| 25 | @end |
| 26 | @interface NSObject <NSObject> {} |
| 27 | + (id)alloc; |
| 28 | @end |
| 29 | typedef float CGFloat; |
| 30 | typedef struct _NSPoint {} NSRect; |
Mike Stump | e448611 | 2009-07-21 18:45:22 +0000 | [diff] [blame] | 31 | static __inline__ __attribute__((always_inline)) NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { NSRect r; return r; } |
Ted Kremenek | 91d1a14 | 2008-07-01 23:29:51 +0000 | [diff] [blame] | 32 | typedef struct {} NSFastEnumerationState; |
| 33 | @protocol NSFastEnumeration |
| 34 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; |
| 35 | @end |
| 36 | @class NSString; |
| 37 | @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> |
| 38 | - (NSUInteger)count; |
| 39 | @end |
| 40 | @interface NSMutableArray : NSArray |
| 41 | - (void)addObject:(id)anObject; |
| 42 | @end @class NSAppleEventDescriptor; |
| 43 | enum { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, NSBackingStoreBuffered = 2 }; |
| 44 | typedef NSUInteger NSBackingStoreType; |
| 45 | @interface NSResponder : NSObject <NSCoding> {} @end |
| 46 | @protocol NSAnimatablePropertyContainer |
| 47 | - (id)animator; |
| 48 | @end |
| 49 | @protocol NSValidatedUserInterfaceItem |
| 50 | - (SEL)action; |
| 51 | @end |
| 52 | @protocol NSUserInterfaceValidations |
| 53 | - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem; |
| 54 | @end @class NSDate, NSDictionary, NSError, NSException, NSNotification; |
| 55 | enum { NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 << 0, NSClosableWindowMask = 1 << 1, NSMiniaturizableWindowMask = 1 << 2, NSResizableWindowMask = 1 << 3 }; |
| 56 | @interface NSWindow : NSResponder <NSAnimatablePropertyContainer, NSUserInterfaceValidations> {} |
| 57 | - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag; |
| 58 | @end |
| 59 | extern NSString *NSWindowDidBecomeKeyNotification; |
| 60 | @interface NSPanel : NSWindow {} |
| 61 | @end |
| 62 | @class NSTableHeaderView; |
| 63 | |
| 64 | // END delta-debugging reduced header stuff |
| 65 | |
| 66 | @interface MyClass |
| 67 | { |
| 68 | NSMutableArray *panels; |
| 69 | } |
| 70 | - (void)myMethod; |
| 71 | - (void)myMethod2; |
| 72 | @end |
Ted Kremenek | db09a4d | 2008-07-03 04:29:21 +0000 | [diff] [blame] | 73 | |
| 74 | @implementation MyClass // no-warning |
Ted Kremenek | 91d1a14 | 2008-07-01 23:29:51 +0000 | [diff] [blame] | 75 | - (void)myMethod |
| 76 | { |
| 77 | NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; |
| 78 | |
| 79 | [panels addObject:panel]; |
| 80 | |
| 81 | [panel release]; // no-warning |
| 82 | } |
| 83 | - (void)myMethod2 |
| 84 | { |
Ted Kremenek | 99d0269 | 2009-04-03 19:02:51 +0000 | [diff] [blame] | 85 | NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // no-warning |
Ted Kremenek | 91d1a14 | 2008-07-01 23:29:51 +0000 | [diff] [blame] | 86 | |
Ted Kremenek | cf118d4 | 2009-02-04 23:49:09 +0000 | [diff] [blame] | 87 | [panels addObject:panel]; |
Ted Kremenek | 91d1a14 | 2008-07-01 23:29:51 +0000 | [diff] [blame] | 88 | } |
| 89 | @end |
| 90 | |