NSPanel.m revision 65d39251ff57b8e33cf6d3a7fcc6aa1c6f8cdc68
1// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s 2// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s 3// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s 4// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s 5 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; 31static __inline__ __attribute__((always_inline)) NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { NSRect r; return r; } 32typedef 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 73 74@implementation MyClass // no-warning 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{ 85 NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // no-warning 86 87 [panels addObject:panel]; 88} 89@end 90 91