summaryrefslogtreecommitdiff
path: root/test/Tooling
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2017-08-18 21:26:34 +0000
committerJohannes Altmanninger <aclopte@gmail.com>2017-08-18 21:26:34 +0000
commitee444f1e76dacd6593a5924b4f15bbec471010f7 (patch)
tree0391d87750fc0f2a8b96bd84bd99eca8231fb20b /test/Tooling
parent5ce0ae8c6ac9dc99e4807f2989be4c6c50975c5e (diff)
[clang-diff] Move printing of matches and changes to clang-diff
Summary: This also changes the output order of the changes. Now the matches are printed in pre-order, intertwined with insertions, updates, and moves. Deletions are printed afterwards. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Tooling')
-rw-r--r--test/Tooling/clang-diff-basic.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/Tooling/clang-diff-basic.cpp b/test/Tooling/clang-diff-basic.cpp
index ac676991e9..e70171509d 100644
--- a/test/Tooling/clang-diff-basic.cpp
+++ b/test/Tooling/clang-diff-basic.cpp
@@ -31,6 +31,10 @@ public:
int id(int i) { return i; }
};
}
+
+void m() { int x = 0 + 0 + 0; }
+int um = 1 + 2 + 3;
+
#else
// CHECK: Match TranslationUnitDecl{{.*}} to TranslationUnitDecl
// CHECK: Match NamespaceDecl: src{{.*}} to NamespaceDecl: dst
@@ -54,8 +58,8 @@ const char *b = "f" "o" "o";
typedef unsigned nat;
// CHECK: Match VarDecl: p(int){{.*}} to VarDecl: prod(double)
-// CHECK: Match BinaryOperator: *{{.*}} to BinaryOperator: *
// CHECK: Update VarDecl: p(int){{.*}} to prod(double)
+// CHECK: Match BinaryOperator: *{{.*}} to BinaryOperator: *
double prod = 1 * 2 * 10;
// CHECK: Update DeclRefExpr
int squared = prod * prod;
@@ -70,9 +74,15 @@ class X {
return "foo";
return 0;
}
- // CHECK: Delete AccessSpecDecl: public
- X(){};
- // CHECK: Delete CXXMethodDecl
+ X(){}
};
}
+
+// CHECK: Move DeclStmt{{.*}} into CompoundStmt
+void m() { { int x = 0 + 0 + 0; } }
+// CHECK: Update and Move IntegerLiteral: 7{{.*}} into BinaryOperator: +({{.*}}) at 1
+int um = 1 + 7;
#endif
+
+// CHECK: Delete AccessSpecDecl: public
+// CHECK: Delete CXXMethodDecl