blob: 20e3efff4c60706b26902fb73f1a839e7e2d1f2c [file] [log] [blame]
Ted Kremenek8382cf52009-11-13 18:46:29 +00001// 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 Kremenek91d1a142008-07-01 23:29:51 +00005
6// BEGIN delta-debugging reduced header stuff
7
8typedef struct objc_selector *SEL;
9typedef signed char BOOL;
10typedef unsigned int NSUInteger;
11typedef 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
29typedef float CGFloat;
30typedef struct _NSPoint {} NSRect;
Mike Stumpe4486112009-07-21 18:45:22 +000031static __inline__ __attribute__((always_inline)) NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { NSRect r; return r; }
Ted Kremenek91d1a142008-07-01 23:29:51 +000032typedef 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;
43enum { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, NSBackingStoreBuffered = 2 };
44typedef 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;
55enum { 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
59extern 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 Kremenekdb09a4d2008-07-03 04:29:21 +000073
74@implementation MyClass // no-warning
Ted Kremenek91d1a142008-07-01 23:29:51 +000075- (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 Kremenek99d02692009-04-03 19:02:51 +000085 NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // no-warning
Ted Kremenek91d1a142008-07-01 23:29:51 +000086
Ted Kremenekcf118d42009-02-04 23:49:09 +000087 [panels addObject:panel];
Ted Kremenek91d1a142008-07-01 23:29:51 +000088}
89@end
90