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