1 // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=basic -analyzer-constraints=basic -verify %s
2 // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=basic -analyzer-constraints=range -verify %s
3 // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=region -analyzer-constraints=basic -verify %s
4 // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=region -analyzer-constraints=range -verify %s
6 // These declarations were reduced using Delta-Debugging from Foundation.h
7 // on Mac OS X. The test cases are below.
9 typedef struct objc_selector *SEL;
10 typedef signed char BOOL;
11 typedef unsigned int NSUInteger;
12 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
14 - (BOOL)isEqual:(id)object;
17 @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;
19 @interface NSObject <NSObject> {}
22 typedef float CGFloat;
23 typedef struct _NSPoint {} NSRect;
24 NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h);
25 enum { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, NSBackingStoreBuffered = 2 };
26 typedef NSUInteger NSBackingStoreType;
27 @interface NSResponder : NSObject <NSCoding> {}
29 @protocol NSAnimatablePropertyContainer
32 extern NSString *NSAnimationTriggerOrderIn ;
33 @class CIFilter, CALayer, NSDictionary, NSScreen, NSShadow, NSTrackingArea;
34 @interface NSView : NSResponder <NSAnimatablePropertyContainer> {} @end
35 @protocol NSValidatedUserInterfaceItem - (SEL)action; @end
36 @protocol NSUserInterfaceValidations - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem; @end @class NSNotification, NSText, NSView, NSMutableSet, NSSet, NSDate;
37 enum { NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 << 0, NSClosableWindowMask = 1 << 1, NSMiniaturizableWindowMask = 1 << 2, NSResizableWindowMask = 1 << 3 };
38 @interface NSWindow : NSResponder <NSAnimatablePropertyContainer, NSUserInterfaceValidations> {
39 struct __wFlags {} _wFlags;
41 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag;
42 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag screen:(NSScreen *)screen;
43 - (void)orderFrontRegardless;
46 extern NSString *NSWindowDidBecomeKeyNotification;
51 NSWindow *window = [[NSWindow alloc]
52 initWithContentRect:NSMakeRect(0,0,100,100)
53 styleMask:NSTitledWindowMask|NSClosableWindowMask
54 backing:NSBackingStoreBuffered
57 [window orderFrontRegardless]; // no-warning
61 NSWindow *window = [[NSWindow alloc]
62 initWithContentRect:NSMakeRect(0,0,100,100)
63 styleMask:NSTitledWindowMask|NSClosableWindowMask
64 backing:NSBackingStoreBuffered
68 [window orderFrontRegardless]; // no-warning
72 // FIXME: NSWindow doesn't own itself until it is displayed.
73 NSWindow *window = [[NSWindow alloc] // no-warning
74 initWithContentRect:NSMakeRect(0,0,100,100)
75 styleMask:NSTitledWindowMask|NSClosableWindowMask
76 backing:NSBackingStoreBuffered
80 [window orderFrontRegardless];
87 // FIXME: For now we don't track NSWindow.
88 NSWindow *window = [NSWindow alloc]; // expected-warning{{never read}}