1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount,alpha.core -verify -Wno-objc-root-class %s
2 // expected-no-diagnostics
4 // BEGIN delta-debugging reduced header stuff
6 typedef struct objc_selector *SEL;
7 typedef signed char BOOL;
8 typedef unsigned int NSUInteger;
9 typedef struct _NSZone NSZone;
10 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
12 - (BOOL)isEqual:(id)object;
13 - (oneway void)release;
16 - (id)copyWithZone:(NSZone *)zone;
18 @protocol NSMutableCopying
19 - (id)mutableCopyWithZone:(NSZone *)zone;
22 - (void)encodeWithCoder:(NSCoder *)aCoder;
24 @interface NSObject <NSObject> {}
27 typedef float CGFloat;
28 typedef struct _NSPoint {} NSRect;
29 static __inline__ __attribute__((always_inline)) NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { NSRect r; return r; }
30 typedef struct {} NSFastEnumerationState;
31 @protocol NSFastEnumeration
32 - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
35 @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
38 @interface NSMutableArray : NSArray
39 - (void)addObject:(id)anObject;
40 @end @class NSAppleEventDescriptor;
41 enum { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, NSBackingStoreBuffered = 2 };
42 typedef NSUInteger NSBackingStoreType;
43 @interface NSResponder : NSObject <NSCoding> {} @end
44 @protocol NSAnimatablePropertyContainer
47 @protocol NSValidatedUserInterfaceItem
50 @protocol NSUserInterfaceValidations
51 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem;
52 @end @class NSDate, NSDictionary, NSError, NSException, NSNotification;
53 enum { NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 << 0, NSClosableWindowMask = 1 << 1, NSMiniaturizableWindowMask = 1 << 2, NSResizableWindowMask = 1 << 3 };
54 @interface NSWindow : NSResponder <NSAnimatablePropertyContainer, NSUserInterfaceValidations> {}
55 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag;
57 extern NSString *NSWindowDidBecomeKeyNotification;
58 @interface NSPanel : NSWindow {}
60 @class NSTableHeaderView;
62 // END delta-debugging reduced header stuff
66 NSMutableArray *panels;
72 @implementation MyClass // no-warning
75 NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1];
77 [panels addObject:panel];
79 [panel release]; // no-warning
83 NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // no-warning
85 [panels addObject:panel];