summaryrefslogtreecommitdiff
path: root/test/Tooling
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2017-08-20 10:22:32 +0000
committerJohannes Altmanninger <aclopte@gmail.com>2017-08-20 10:22:32 +0000
commit544626fd1a0364617e75c3511addbff936ce315a (patch)
tree9fc822dda95f710a2b3b8e4c462f2ee0a3e7c88f /test/Tooling
parent598a0a07067dc11b288c1f5da482003eb4439d68 (diff)
[clang-diff] Filter AST nodes
Summary: Ignore macros and implicit AST nodes, as well as anything outside of the main source file. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36184 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311280 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Tooling')
-rw-r--r--test/Tooling/clang-diff-ast.cpp24
-rw-r--r--test/Tooling/clang-diff-json.cpp2
2 files changed, 24 insertions, 2 deletions
diff --git a/test/Tooling/clang-diff-ast.cpp b/test/Tooling/clang-diff-ast.cpp
index a79648d3f6..970031a95b 100644
--- a/test/Tooling/clang-diff-ast.cpp
+++ b/test/Tooling/clang-diff-ast.cpp
@@ -12,7 +12,8 @@ void f() {
// CHECK: IntegerLiteral: 1
auto i = 1;
// CHECK: CallExpr(
- // CHECK: DeclRefExpr: f(
+ // CHECK-NOT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr: f(
f();
// CHECK: BinaryOperator: =(
i = i;
@@ -37,6 +38,7 @@ class X : Base {
if (i == 0)
// CHECK: StringLiteral: foo(
return "foo";
+ // CHECK-NOT: ImplicitCastExpr
return 0;
}
@@ -48,3 +50,23 @@ public:
int x = m;
}
};
+
+#define M (void)1
+#define MA(a, b) (void)a, b
+// CHECK: FunctionDecl
+// CHECK-NEXT: CompoundStmt
+void macros() {
+ M;
+ MA(1, 2);
+}
+
+#ifndef GUARD
+#define GUARD
+// CHECK-NEXT: NamespaceDecl
+namespace world {
+// nodes from other files are excluded, there should be no output here
+#include "clang-diff-ast.cpp"
+}
+// CHECK-NEXT: FunctionDecl: sentinel
+void sentinel();
+#endif
diff --git a/test/Tooling/clang-diff-json.cpp b/test/Tooling/clang-diff-json.cpp
index cbbd48ea84..9aac6fa8b1 100644
--- a/test/Tooling/clang-diff-json.cpp
+++ b/test/Tooling/clang-diff-json.cpp
@@ -3,9 +3,9 @@
// RUN: | FileCheck %s
// CHECK: "begin": 299,
-// CHECK: "type": "CXXRecordDecl",
// CHECK: "type": "FieldDecl",
// CHECK: "end": 319,
+// CHECK: "type": "CXXRecordDecl",
class A {
int x;
};