inline-defensive-checks.m revision 42773d64f98db0dd5cc80181c3b2d561851668f7
1// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config suppress-inlined-defensive-checks=true -verify %s
2
3typedef signed char BOOL;
4typedef struct objc_class *Class;
5typedef struct objc_object {
6  Class isa;
7} *id;
8@protocol NSObject  - (BOOL)isEqual:(id)object; @end
9@interface NSObject <NSObject> {}
10+(id)alloc;
11+(id)new;
12-(id)init;
13-(id)autorelease;
14-(id)copy;
15- (Class)class;
16-(id)retain;
17@end
18
19// expected-no-diagnostics
20// Check that inline defensive checks is triggered for null expressions
21// within CompoundLiteralExpr.
22typedef union {
23  struct dispatch_object_s *_do;
24  struct dispatch_source_s *_ds;
25} dispatch_object_t __attribute__((__transparent_union__));
26typedef struct dispatch_source_s *dispatch_source_t;
27
28extern __attribute__((visibility("default"))) __attribute__((__nonnull__)) __attribute__((__nothrow__))
29void
30dispatch_resume(dispatch_object_t object);
31
32@interface AppDelegate : NSObject {
33@protected
34	dispatch_source_t p;
35}
36@end
37@implementation AppDelegate
38- (void)updateDeleteTimer {
39	if (p != ((void*)0))
40		;
41}
42- (void)createAndStartDeleteTimer {
43  [self updateDeleteTimer];
44  dispatch_resume(p); // no warning
45}
46@end
47