2009-12-17 09:44:13 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
|
|
|
|
|
2009-12-19 04:13:39 +08:00
|
|
|
// Test basic handling of references.
|
2009-12-17 09:44:13 +08:00
|
|
|
char &test1_aux();
|
|
|
|
char *test1() {
|
|
|
|
return &test1_aux();
|
|
|
|
}
|
2009-12-19 04:13:39 +08:00
|
|
|
|
2009-12-19 11:17:55 +08:00
|
|
|
// Test test1_aux() evaluates to char &.
|
2009-12-19 04:13:39 +08:00
|
|
|
char test1_as_rvalue() {
|
|
|
|
return test1_aux();
|
|
|
|
}
|
|
|
|
|
2009-12-23 08:26:16 +08:00
|
|
|
// Test passing a value as a reference. The 'const' in test2_aux() adds
|
|
|
|
// an ImplicitCastExpr, which is evaluated as an lvalue.
|
|
|
|
int test2_aux(const int &n);
|
|
|
|
int test2(int n) {
|
|
|
|
return test2_aux(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
int test2_b_aux(const short &n);
|
|
|
|
int test2_b(int n) {
|
|
|
|
return test2_b_aux(n);
|
|
|
|
}
|