1// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,alpha.core -analyzer-constraints=range -analyzer-store=region -verify %s
2// expected-no-diagnostics
3//
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;
55- (id)copyWithZone:(NSZone *)zone { return 0; }
56- (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  }
63  while (1) {}
64}
65@end
66