1 // RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1
2 // RUN: FileCheck -input-file=%t.1 -check-prefix=CHECK-darwin8 %s
3 // RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1
4 // RUN: FileCheck -input-file=%t.2 -check-prefix=CHECK-darwin9 %s
5 // RUN: %clang_analyze_cc1 -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1
6 // RUN: FileCheck -input-file=%t.3 -check-prefix=CHECK-darwin9 %s
11 - (long long)longlongM;
12 - (unsigned long long)unsignedLongLongM;
14 - (long double)longDoubleM;
17 @implementation MyClass
18 - (void *)voidPtrM { return (void *)0; }
19 - (int)intM { return 0; }
20 - (long long)longlongM { return 0; }
21 - (unsigned long long)unsignedLongLongM { return 0; }
22 - (double)doubleM { return 0.0; }
23 - (long double)longDoubleM { return 0.0; }
27 void createFoo(void) {
30 void *v = [obj voidPtrM]; // no-warning
31 int i = [obj intM]; // no-warning
34 void createFoo2(void) {
37 long double ld = [obj longDoubleM];
40 void createFoo3(void) {
44 long long ll = [obj longlongM];
47 void createFoo4(void) {
50 double d = [obj doubleM];
53 void createFoo5(void) {
54 MyClass *obj = (id)@"";
56 double d = [obj doubleM]; // no-warning
59 void createFoo6(void) {
63 unsigned long long ull = [obj unsignedLongLongM];
66 void handleNilPruneLoop(MyClass *obj) {
70 // Test if [obj intM] evaluates to 0, thus pruning the entire loop.
71 for (int i = 0; i < [obj intM]; i++) {
72 long long j = [obj longlongM];
75 long long j = [obj longlongM];
78 int handleVoidInComma(void) {
80 return [obj voidM], 0;
83 int marker(void) { // non-void function does not return a value
86 // CHECK-darwin8: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
87 // CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
88 // CHECK-darwin8: warning: The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage
89 // CHECK-darwin8: warning: The receiver of message 'unsignedLongLongM' is nil and returns a value of type 'unsigned long long' that will be garbage
90 // CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
92 // CHECK-darwin9-NOT: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
93 // CHECK-darwin9-NOT: warning: The receiver of message 'unsignedLongLongM' is nil and returns a value of type 'unsigned long long' that will be garbage
94 // CHECK-darwin9-NOT: warning: The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage
95 // CHECK-darwin9-NOT: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
96 // CHECK-darwin9-NOT: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
97 // CHECK-darwin9: 1 warning generated