summaryrefslogtreecommitdiff
path: root/test/Tooling/clang-diff-ast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Tooling/clang-diff-ast.cpp')
-rw-r--r--test/Tooling/clang-diff-ast.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/Tooling/clang-diff-ast.cpp b/test/Tooling/clang-diff-ast.cpp
new file mode 100644
index 0000000000..bfa90c6560
--- /dev/null
+++ b/test/Tooling/clang-diff-ast.cpp
@@ -0,0 +1,50 @@
+// 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;
+ // CHECK: CXXMethodDecl: foo(const char *(int))(
+ // CHECK: ParmVarDecl: i(int)(
+ const char *foo(int i) {
+ if (i == 0)
+ // CHECK: StringLiteral: foo(
+ return "foo";
+ return 0;
+ }
+
+ // CHECK: AccessSpecDecl: public(
+public:
+ // CHECK: CXXConstructorDecl: X(void (char, int))(
+ X(char, int) : Base(), m(0) {
+ // CHECK: MemberExpr(
+ int x = m;
+ }
+};