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