2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
|
2009-12-10 07:02:17 +08:00
|
|
|
|
|
|
|
// CHECK: example0
|
|
|
|
void example0() {
|
|
|
|
double d = 2.0;
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}rd 'double &'
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK-NEXT: DeclRefExpr
|
|
|
|
double &rd = d;
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}rcd 'const double &'
|
2010-11-18 14:31:45 +08:00
|
|
|
// CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' lvalue <NoOp>
|
2009-12-10 07:02:17 +08:00
|
|
|
const double &rcd = d;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct A { };
|
|
|
|
struct B : A { } b;
|
|
|
|
|
|
|
|
// CHECK: example1
|
|
|
|
void example1() {
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}ra 'struct A &'
|
2010-11-18 14:31:45 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' lvalue <DerivedToBase (A)>
|
2009-12-10 07:02:17 +08:00
|
|
|
A &ra = b;
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}rca 'const struct A &'
|
2010-11-18 14:31:45 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'const struct A' lvalue <NoOp>
|
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' lvalue <DerivedToBase (A)>
|
2009-12-10 07:02:17 +08:00
|
|
|
const A& rca = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern B f();
|
|
|
|
|
|
|
|
struct X {
|
|
|
|
operator B();
|
|
|
|
} x;
|
|
|
|
|
|
|
|
// CHECK: example2
|
|
|
|
void example2() {
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}rca 'const struct A &'
|
2010-09-05 08:17:29 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'const struct A' <NoOp>
|
2010-04-25 03:06:50 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
2010-03-10 19:27:22 +08:00
|
|
|
// CHECK: CallExpr{{.*}}B
|
2009-12-10 07:02:17 +08:00
|
|
|
const A &rca = f();
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}r 'const struct A &'
|
2010-09-05 08:17:29 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'const struct A' <NoOp>
|
2010-04-25 03:06:50 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK: CXXMemberCallExpr{{.*}}'struct B'
|
|
|
|
const A& r = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: example3
|
|
|
|
void example3() {
|
2012-12-20 10:09:13 +08:00
|
|
|
// CHECK: VarDecl{{.*}}rcd2 'const double &'
|
2010-11-18 14:31:45 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}} <IntegralToFloating>
|
2009-12-10 07:02:17 +08:00
|
|
|
const double& rcd2 = 2;
|
|
|
|
}
|