Ted Kremenek | e1cea75 | 2009-07-06 21:58:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s && |
Ted Kremenek | 7d7c439 | 2009-07-11 00:07:06 +0000 | [diff] [blame] | 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 |
Ted Kremenek | 0bdf178 | 2009-02-20 00:10:09 +0000 | [diff] [blame] | 4 | // |
| 5 | // This test case mainly checks that the retain/release checker doesn't crash |
| 6 | // on this file. |
| 7 | // |
| 8 | typedef int int32_t; |
| 9 | typedef signed char BOOL; |
| 10 | typedef long NSInteger; |
| 11 | typedef unsigned long NSUInteger; |
| 12 | typedef 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 { |
| 25 | NSNullCellType = 0, NSTextCellType = 1, NSImageCellType = 2 }; |
| 26 | typedef 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; |
| 35 | typedef NSInteger NSBotnet; |
| 36 | @interface NSControl : NSView { |
| 37 | } |
| 38 | @end @class NSAttributedString, NSFont, NSImage, NSSound; |
| 39 | typedef int32_t Baz; |
| 40 | @interface Bar(BarInternal) - (void)_setIsWhite:(BOOL)isWhite; |
| 41 | @end |
| 42 | @interface Bar (BarBotnetCompatibility) |
| 43 | - (NSBotnet)_initialBotnetZorg; |
| 44 | @end |
| 45 | typedef 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 |
| 55 | static 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 |