1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx -analyzer-output=text -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx -analyzer-output=plist-multi-file %s -o %t.plist
3 // RUN: %normalize_plist <%t.plist | diff -ub %S/Inputs/expected-plists/undef-value-param.m.plist -
5 typedef signed char BOOL;
6 @protocol NSObject - (BOOL)isEqual:(id)object; @end
7 @interface NSObject <NSObject> {}
16 typedef const void * CFTypeRef;
17 extern void CFRelease(CFTypeRef cf);
19 @interface Cell : NSObject
23 @interface SpecialString
25 - (oneway void)release;
28 typedef SpecialString* SCDynamicStoreRef;
29 static void CreateRef(SCDynamicStoreRef *storeRef, unsigned x);
30 static void CreateRefUndef(SCDynamicStoreRef *storeRef, unsigned x);
31 SCDynamicStoreRef anotherCreateRef(unsigned *err, unsigned x);
35 SCDynamicStoreRef storeRef = 0;
36 CreateRef(&storeRef, 4);
37 //expected-note@-1{{Calling 'CreateRef'}}
38 //expected-note@-2{{Returning from 'CreateRef'}}
39 CFRelease(storeRef); //expected-warning {{Null pointer argument in call to CFRelease}}
40 //expected-note@-1{{Null pointer argument in call to CFRelease}}
44 SCDynamicStoreRef storeRef; // expected-note {{'storeRef' declared without an initial value}}
45 CreateRefUndef(&storeRef, 4);
46 //expected-note@-1{{Calling 'CreateRefUndef'}}
47 //expected-note@-2{{Returning from 'CreateRefUndef'}}
48 CFRelease(storeRef); //expected-warning {{1st function call argument is an uninitialized value}}
49 //expected-note@-1{{1st function call argument is an uninitialized value}}
53 static void CreateRef(SCDynamicStoreRef *storeRef, unsigned x) {
55 SCDynamicStoreRef ref = anotherCreateRef(&err, x);
57 //expected-note@-1{{Assuming 'err' is not equal to 0}}
58 //expected-note@-2{{Taking true branch}}
60 ref = 0; // expected-note{{nil object reference stored to 'ref'}}
62 *storeRef = ref; // expected-note{{nil object reference stored to 'storeRef'}}
65 static void CreateRefUndef(SCDynamicStoreRef *storeRef, unsigned x) {
67 SCDynamicStoreRef ref = anotherCreateRef(&err, x);
69 //expected-note@-1{{Assuming 'err' is not equal to 0}}
70 //expected-note@-2{{Taking true branch}}
72 return; // expected-note{{Returning without writing to '*storeRef'}}