1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount,alpha.core,deadcode.DeadStores -verify %s
3 // These declarations were reduced using Delta-Debugging from Foundation.h
4 // on Mac OS X. The test cases are below.
6 typedef struct objc_selector *SEL;
7 typedef signed char BOOL;
8 typedef unsigned int NSUInteger;
9 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
11 - (BOOL)isEqual:(id)object;
14 @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;
16 @interface NSObject <NSObject> {}
19 typedef float CGFloat;
20 typedef struct _NSPoint {} NSRect;
21 NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h);
22 enum { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, NSBackingStoreBuffered = 2 };
23 typedef NSUInteger NSBackingStoreType;
24 @interface NSResponder : NSObject <NSCoding> {}
26 @protocol NSAnimatablePropertyContainer
29 extern NSString *NSAnimationTriggerOrderIn ;
30 @class CIFilter, CALayer, NSDictionary, NSScreen, NSShadow, NSTrackingArea;
31 @interface NSView : NSResponder <NSAnimatablePropertyContainer> {} @end
32 @protocol NSValidatedUserInterfaceItem - (SEL)action; @end
33 @protocol NSUserInterfaceValidations - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem; @end @class NSNotification, NSText, NSView, NSMutableSet, NSSet, NSDate;
34 enum { NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 << 0, NSClosableWindowMask = 1 << 1, NSMiniaturizableWindowMask = 1 << 2, NSResizableWindowMask = 1 << 3 };
35 @interface NSWindow : NSResponder <NSAnimatablePropertyContainer, NSUserInterfaceValidations> {
36 struct __wFlags {} _wFlags;
38 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag;
39 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag screen:(NSScreen *)screen;
40 - (void)orderFrontRegardless;
43 extern NSString *NSWindowDidBecomeKeyNotification;
48 NSWindow *window = [[NSWindow alloc]
49 initWithContentRect:NSMakeRect(0,0,100,100)
50 styleMask:NSTitledWindowMask|NSClosableWindowMask
51 backing:NSBackingStoreBuffered
54 [window orderFrontRegardless]; // no-warning
58 NSWindow *window = [[NSWindow alloc]
59 initWithContentRect:NSMakeRect(0,0,100,100)
60 styleMask:NSTitledWindowMask|NSClosableWindowMask
61 backing:NSBackingStoreBuffered
65 [window orderFrontRegardless]; // no-warning
69 // FIXME: NSWindow doesn't own itself until it is displayed.
70 NSWindow *window = [[NSWindow alloc] // no-warning
71 initWithContentRect:NSMakeRect(0,0,100,100)
72 styleMask:NSTitledWindowMask|NSClosableWindowMask
73 backing:NSBackingStoreBuffered
77 [window orderFrontRegardless];
84 // FIXME: For now we don't track NSWindow.
85 NSWindow *window = [NSWindow alloc]; // expected-warning{{never read}}