brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 95fbf56 Raw
89 lines · plain
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount,alpha.core -verify -Wno-objc-root-class %s2// expected-no-diagnostics3 4// BEGIN delta-debugging reduced header stuff5 6typedef struct objc_selector *SEL;7typedef signed char BOOL;8typedef unsigned int NSUInteger;9typedef struct _NSZone NSZone;10@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;11@protocol NSObject12- (BOOL)isEqual:(id)object;13- (oneway void)release;14@end15@protocol NSCopying16- (id)copyWithZone:(NSZone *)zone;17@end18@protocol NSMutableCopying19- (id)mutableCopyWithZone:(NSZone *)zone;20@end21@protocol NSCoding22- (void)encodeWithCoder:(NSCoder *)aCoder;23@end24@interface NSObject <NSObject> {}25+ (id)alloc;26@end27typedef float CGFloat;28typedef struct _NSPoint {} NSRect;29static __inline__ __attribute__((always_inline)) NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { NSRect r; return r; }30typedef struct {} NSFastEnumerationState;31@protocol NSFastEnumeration 32- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;33@end34@class NSString;35@interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>36- (NSUInteger)count;37@end38@interface NSMutableArray : NSArray39- (void)addObject:(id)anObject;40@end @class NSAppleEventDescriptor;41enum { NSBackingStoreRetained = 0,     NSBackingStoreNonretained = 1,     NSBackingStoreBuffered = 2 };42typedef NSUInteger NSBackingStoreType;43@interface NSResponder : NSObject <NSCoding> {} @end44@protocol NSAnimatablePropertyContainer45- (id)animator;46@end47@protocol NSValidatedUserInterfaceItem48- (SEL)action;49@end50@protocol NSUserInterfaceValidations51- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem;52@end  @class NSDate, NSDictionary, NSError, NSException, NSNotification;53enum { 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;56@end57extern NSString *NSWindowDidBecomeKeyNotification;58@interface NSPanel : NSWindow {}59@end60@class NSTableHeaderView;61 62// END delta-debugging reduced header stuff63 64@interface MyClass65{66	NSMutableArray *panels;67}68- (void)myMethod;69- (void)myMethod2;70@end71 72@implementation MyClass // no-warning73- (void)myMethod74{75  NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1];76 77  [panels addObject:panel];78 79  [panel release]; // no-warning80}81- (void)myMethod282{83  NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // no-warning84 85  [panels addObject:panel];  86}87@end88 89