50 lines · plain
1// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -verify -fblocks %s2// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -analyzer-checker=core,alpha.core -verify -fblocks %s3// expected-no-diagnostics4 5//===----------------------------------------------------------------------===//6// This files tests our path-sensitive handling of Objective-c++ files.7//===----------------------------------------------------------------------===//8 9// Test basic handling of references.10char &test1_aux();11char *test1() {12 return &test1_aux();13}14 15// Test test1_aux() evaluates to char &.16char test1_as_rvalue() {17 return test1_aux();18}19 20// Test basic handling of references with Objective-C classes.21@interface Test122- (char&) foo;23@end24 25char* Test1_harness(Test1 *p) {26 return &[p foo];27}28 29char Test1_harness_b(Test1 *p) {30 return [p foo];31}32 33// Basic test of C++ references with Objective-C pointers.34@interface RDar1056902435@property(readonly) int x;36@end37 38typedef RDar10569024* RDar10569024Ref;39 40void rdar10569024_aux(RDar10569024Ref o);41 42int rdar10569024(id p, id collection) {43 for (id elem in collection) {44 const RDar10569024Ref &o = (RDar10569024Ref) elem;45 rdar10569024_aux(o); // no-warning46 return o.x; // no-warning47 }48 return 0;49}50