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