2017-08-19 17:36:14 +08:00
|
|
|
// RUN: clang-diff -ast-dump %s -- -std=c++11 | FileCheck %s
|
|
|
|
|
|
|
|
|
|
|
|
// CHECK: {{^}}TranslationUnitDecl(0)
|
|
|
|
// CHECK: {{^}} NamespaceDecl: test;(
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
// CHECK: {{^}} FunctionDecl: f(
|
|
|
|
// CHECK: CompoundStmt(
|
|
|
|
void f() {
|
|
|
|
// CHECK: VarDecl: i(int)(
|
|
|
|
// CHECK: IntegerLiteral: 1
|
|
|
|
auto i = 1;
|
|
|
|
// CHECK: CallExpr(
|
|
|
|
// CHECK: DeclRefExpr: f(
|
|
|
|
f();
|
|
|
|
// CHECK: BinaryOperator: =(
|
|
|
|
i = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace test
|
|
|
|
|
|
|
|
// CHECK: TypedefDecl: nat;unsigned int;(
|
|
|
|
typedef unsigned nat;
|
|
|
|
// CHECK: TypeAliasDecl: real;double;(
|
|
|
|
using real = double;
|
|
|
|
|
|
|
|
class Base {
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: CXXRecordDecl: X;class X;(
|
|
|
|
class X : Base {
|
|
|
|
int m;
|
2017-08-19 18:05:24 +08:00
|
|
|
// CHECK: CXXMethodDecl: foo(const char *(int)
|
2017-08-19 17:36:14 +08:00
|
|
|
// CHECK: ParmVarDecl: i(int)(
|
|
|
|
const char *foo(int i) {
|
|
|
|
if (i == 0)
|
|
|
|
// CHECK: StringLiteral: foo(
|
|
|
|
return "foo";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: AccessSpecDecl: public(
|
|
|
|
public:
|
2017-08-20 08:02:20 +08:00
|
|
|
// CHECK: CXXConstructorDecl: X(void (char, int){{( __attribute__\(\(thiscall\)\))?}})(
|
2017-08-19 17:36:14 +08:00
|
|
|
X(char, int) : Base(), m(0) {
|
|
|
|
// CHECK: MemberExpr(
|
|
|
|
int x = m;
|
|
|
|
}
|
|
|
|
};
|