rdar-6562655.m revision 7d7c4395df80fbf431396509c54ffb3e02884041
1// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s && 2// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=basic-old-cast -verify %s && 3// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=region -verify %s 4// 5// This test case mainly checks that the retain/release checker doesn't crash 6// on this file. 7// 8typedef int int32_t; 9typedef signed char BOOL; 10typedef long NSInteger; 11typedef unsigned long NSUInteger; 12typedef struct _NSZone NSZone; 13@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; 14@protocol NSObject - (BOOL)isEqual:(id)object; 15@end @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; 16@end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; 17@end @interface NSObject <NSObject> {} 18@end extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); 19@interface NSResponder : NSObject <NSCoding> {} 20@end @protocol NSAnimatablePropertyContainer - (id)animator; 21@end extern NSString *NSAnimationTriggerOrderIn ; 22@interface NSView : NSResponder <NSAnimatablePropertyContainer> { 23} 24@end enum { 25NSNullCellType = 0, NSTextCellType = 1, NSImageCellType = 2 }; 26typedef struct __CFlags { 27 unsigned int botnet:3; 28} 29 _CFlags; 30@interface Bar : NSObject <NSCopying, NSCoding> { 31 _CFlags _cFlags; 32@private id _support; 33} 34@end extern NSString *NSControlTintDidChangeNotification; 35typedef NSInteger NSBotnet; 36@interface NSControl : NSView { 37} 38@end @class NSAttributedString, NSFont, NSImage, NSSound; 39typedef int32_t Baz; 40@interface Bar(BarInternal) - (void)_setIsWhite:(BOOL)isWhite; 41@end 42@interface Bar (BarBotnetCompatibility) 43- (NSBotnet)_initialBotnetZorg; 44@end 45typedef struct _NSRunArrayItem { 46 unsigned int botnetIsSet:1; 47} BarAuxFlags; 48@interface BarAuxiliary : NSObject { 49@public 50 NSControl *controlView; 51 BarAuxFlags auxCFlags; 52} 53@end 54@implementation Bar 55static Baz Qux = 0; 56- (id)copyWithZone:(NSZone *)zone {} 57- (void)encodeWithCoder:(NSCoder *)coder {} 58@end 59@implementation Bar (BarBotnet) 60- (NSBotnet)botnet { 61 if (!(*(BarAuxiliary **)&self->_support)->auxCFlags.botnetIsSet) { 62 _cFlags.botnet = [self _initialBotnetZorg]; 63 } 64} 65@end 66