summaryrefslogtreecommitdiff
path: root/test/Tooling
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2017-08-20 16:18:43 +0000
committerJohannes Altmanninger <aclopte@gmail.com>2017-08-20 16:18:43 +0000
commitfbdebfae845511dae1ff852aa303205a1dee5ebf (patch)
tree5ca1840ea14d20b014724ae30b1b4eb3aa96261d /test/Tooling
parent0366408204172d476c3e10712e2d298ff69c72b5 (diff)
downloadclang-fbdebfae845511dae1ff852aa303205a1dee5ebf.tar.gz
[clang-diff] Improve and test getNodeValue
Summary: Use qualified names if available. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36186 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311292 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Tooling')
-rw-r--r--test/Tooling/clang-diff-ast.cpp28
-rw-r--r--test/Tooling/clang-diff-basic.cpp10
-rw-r--r--test/Tooling/clang-diff-bottomup.cpp2
-rw-r--r--test/Tooling/clang-diff-html.test4
-rw-r--r--test/Tooling/clang-diff-opt.cpp1
-rw-r--r--test/Tooling/clang-diff-topdown.cpp2
6 files changed, 31 insertions, 16 deletions
diff --git a/test/Tooling/clang-diff-ast.cpp b/test/Tooling/clang-diff-ast.cpp
index 970031a95b..9381489f8f 100644
--- a/test/Tooling/clang-diff-ast.cpp
+++ b/test/Tooling/clang-diff-ast.cpp
@@ -5,22 +5,31 @@
// CHECK: {{^}} NamespaceDecl: test;(
namespace test {
-// CHECK: {{^}} FunctionDecl: f(
+// CHECK: {{^}} FunctionDecl: test::f(
// CHECK: CompoundStmt(
void f() {
// CHECK: VarDecl: i(int)(
// CHECK: IntegerLiteral: 1
auto i = 1;
+ // CHECK: FloatingLiteral: 1.5(
+ auto r = 1.5;
+ // CHECK: CXXBoolLiteralExpr: true(
+ auto b = true;
// CHECK: CallExpr(
// CHECK-NOT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr: f(
+ // CHECK: DeclRefExpr: test::f(
f();
+ // CHECK: UnaryOperator: ++(
+ ++i;
// CHECK: BinaryOperator: =(
i = i;
}
} // end namespace test
+// CHECK: UsingDirectiveDecl: test(
+using namespace test;
+
// CHECK: TypedefDecl: nat;unsigned int;(
typedef unsigned nat;
// CHECK: TypeAliasDecl: real;double;(
@@ -29,10 +38,10 @@ using real = double;
class Base {
};
-// CHECK: CXXRecordDecl: X;class X;(
+// CHECK: CXXRecordDecl: X;X;(
class X : Base {
int m;
- // CHECK: CXXMethodDecl: foo(const char *(int)
+ // CHECK: CXXMethodDecl: X::foo(const char *(int)
// CHECK: ParmVarDecl: i(int)(
const char *foo(int i) {
if (i == 0)
@@ -44,11 +53,16 @@ class X : Base {
// CHECK: AccessSpecDecl: public(
public:
- // CHECK: CXXConstructorDecl: X(void (char, int){{( __attribute__\(\(thiscall\)\))?}})(
- X(char, int) : Base(), m(0) {
- // CHECK: MemberExpr(
+ int not_initialized;
+ // All initialized members, bases and delegating initializers are are
+ // appended, separated by commas.
+ // CHECK: CXXConstructorDecl: X::X(void (char, int){{( __attribute__\(\(thiscall\)\))?}})Base,X::m,(
+ X(char c, int) : Base(), m(0) {
+ // CHECK: MemberExpr: X::m(
int x = m;
}
+ // CHECK: CXXConstructorDecl: X::X(void (char))X,(
+ X(char s) : X(s, 4) {}
};
#define M (void)1
diff --git a/test/Tooling/clang-diff-basic.cpp b/test/Tooling/clang-diff-basic.cpp
index aa78d5dc52..5febd7265d 100644
--- a/test/Tooling/clang-diff-basic.cpp
+++ b/test/Tooling/clang-diff-basic.cpp
@@ -11,18 +11,18 @@ void foo() {
}
}
-// CHECK: Match DeclRefExpr: foo{{.*}} to DeclRefExpr: inner::foo
+// CHECK: Match DeclRefExpr: src::foo{{.*}} to DeclRefExpr: dst::inner::foo
void main() { inner::foo(); }
// CHECK: Match StringLiteral: foo{{.*}} to StringLiteral: foo
const char *b = "f" "o" "o";
// unsigned is canonicalized to unsigned int
-// CHECK: Match TypedefDecl: nat;unsigned int;{{.*}} to TypedefDecl: nat;unsigned int;
+// CHECK: Match TypedefDecl: src::nat;unsigned int;{{.*}} to TypedefDecl: dst::nat;unsigned int;
typedef unsigned nat;
-// CHECK: Match VarDecl: p(int){{.*}} to VarDecl: prod(double)
-// CHECK: Update VarDecl: p(int){{.*}} to prod(double)
+// CHECK: Match VarDecl: src::p(int){{.*}} to VarDecl: dst::prod(double)
+// CHECK: Update VarDecl: src::p(int){{.*}} to dst::prod(double)
// CHECK: Match BinaryOperator: *{{.*}} to BinaryOperator: *
double prod = 1 * 2 * 10;
// CHECK: Update DeclRefExpr
@@ -49,7 +49,7 @@ int um = 1 + 7;
namespace {
// match with parents of different type
-// CHECK: Match FunctionDecl: f1{{.*}} to FunctionDecl: f1
+// CHECK: Match FunctionDecl: f1{{.*}} to FunctionDecl: (anonymous namespace)::f1
void f1() {{ (void) __func__;;; }}
}
diff --git a/test/Tooling/clang-diff-bottomup.cpp b/test/Tooling/clang-diff-bottomup.cpp
index 8193ad7bbd..bc5d2cbdf4 100644
--- a/test/Tooling/clang-diff-bottomup.cpp
+++ b/test/Tooling/clang-diff-bottomup.cpp
@@ -16,7 +16,7 @@ void f2() { ;; {{;}} }
void f1() {
// CompoundStmt: 3 matched descendants, subtree sizes 4 and 5
// Jaccard similarity = 3 / (4 + 5 - 3) = 3 / 6 >= 0.5
-// CHECK: Match FunctionDecl: f1(void (void))(1) to FunctionDecl: f1(void (void))(1)
+// CHECK: Match FunctionDecl: f1(void ())(1) to FunctionDecl: f1(void ())(1)
// CHECK: Match CompoundStmt(2) to CompoundStmt(2)
// CHECK: Match CompoundStmt(4) to CompoundStmt(3)
// CHECK: Match CompoundStmt(5) to CompoundStmt(4)
diff --git a/test/Tooling/clang-diff-html.test b/test/Tooling/clang-diff-html.test
index 9b0d6ebb18..876e731e9a 100644
--- a/test/Tooling/clang-diff-html.test
+++ b/test/Tooling/clang-diff-html.test
@@ -11,12 +11,12 @@
// match, move
// CHECK: <span id='L[[L:[0-9]+]]' tid='R[[R:[0-9]+]]' title='FunctionDecl
// CHECK-NEXT: [[L]] -> [[R]]
-// CHECK-NEXT: foo(void (void))' class='m'>void foo()
+// CHECK-NEXT: src::foo(void ())' class='u m'>void foo()
// match
// CHECK: <span id='L[[L:[0-9]+]]' tid='R[[R:[0-9]+]]' title='FunctionDecl
// CHECK-NEXT: [[L]] -> [[R]]
-// CHECK-NEXT: main(void (void))'>void main()
+// CHECK-NEXT: src::main(void ())' class='u'>void main()
// deletion
// CHECK: <span id='L[[L:[0-9]+]]' tid='R-1' title='IntegerLiteral
diff --git a/test/Tooling/clang-diff-opt.cpp b/test/Tooling/clang-diff-opt.cpp
index 567483de1f..771c6abaec 100644
--- a/test/Tooling/clang-diff-opt.cpp
+++ b/test/Tooling/clang-diff-opt.cpp
@@ -41,4 +41,5 @@ void f3() {
// CHECK: Delete NullStmt(22)
;; {{;;;;;;}}
}
+
#endif
diff --git a/test/Tooling/clang-diff-topdown.cpp b/test/Tooling/clang-diff-topdown.cpp
index 5555389939..82aab1033d 100644
--- a/test/Tooling/clang-diff-topdown.cpp
+++ b/test/Tooling/clang-diff-topdown.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -E %s > %t.src.cpp
// RUN: %clang_cc1 -E %s > %t.dst.cpp -DDEST
-// RUN: clang-diff -dump-matches -stop-after=topdown %t.src.cpp %t.dst.cpp -- | FileCheck %s
+// RUN: clang-diff -dump-matches -stop-after=topdown %t.src.cpp %t.dst.cpp -- -std=c++11 | FileCheck %s
//
// Test the top-down matching of identical subtrees only.