1 // RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s
2 // RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
3 // RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
4 // RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
9 - (long long)longlongM;
11 - (long double)longDoubleM;
14 @implementation MyClass
15 - (void *)voidPtrM { return (void *)0; }
16 - (int)intM { return 0; }
17 - (long long)longlongM { return 0; }
18 - (double)doubleM { return 0.0; }
19 - (long double)longDoubleM { return 0.0; }
26 void *v = [obj voidPtrM]; // no-warning
27 int i = [obj intM]; // no-warning
33 long double ld = [obj longDoubleM]; // expected-warning{{The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage}}
40 long long ll = [obj longlongM]; // expected-warning{{The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage}}
46 double d = [obj doubleM]; // expected-warning{{The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage}}
52 double d = [obj doubleM]; // no-warning
55 void handleNilPruneLoop(MyClass *obj) {
59 // Test if [obj intM] evaluates to 0, thus pruning the entire loop.
60 for (int i = 0; i < [obj intM]; i++) {
61 long long j = [obj longlongM]; // no-warning
64 long long j = [obj longlongM]; // expected-warning{{The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage}}
67 int handleVoidInComma() {
69 return [obj voidM], 0;
72 int marker(void) { // control reaches end of non-void function
75 // CHECK-darwin8: control reaches end of non-void function
76 // CHECK-darwin8: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
77 // CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
78 // CHECK-darwin8: warning: The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage
79 // CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
80 // CHECK-darwin8: 5 warnings generated
81 // CHECK-darwin9: control reaches end of non-void function
82 // CHECK-darwin9: 1 warning generated