[PATCH] D36181: [clang-diff] Make printing of matches optional
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 19 05:05:06 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL311237: [clang-diff] Make printing of matches optional (authored by krobelus).
Changed prior to commit:
https://reviews.llvm.org/D36181?vs=109503&id=111815#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36181
Files:
cfe/trunk/test/Tooling/clang-diff-args.test
cfe/trunk/test/Tooling/clang-diff-basic.cpp
cfe/trunk/tools/clang-diff/ClangDiff.cpp
Index: cfe/trunk/test/Tooling/clang-diff-args.test
===================================================================
--- cfe/trunk/test/Tooling/clang-diff-args.test
+++ cfe/trunk/test/Tooling/clang-diff-args.test
@@ -6,3 +6,7 @@
RUN: clang-diff -ast-dump -extra-arg=-Da=X %t.cpp -- 2>&1 | FileCheck %s
RUN: clang-diff -ast-dump -extra-arg-before=-Da=X %t.cpp -- 2>&1 | FileCheck %s
RUN: clang-diff -ast-dump %t.cpp -- 2>&1 -Da=X | FileCheck %s
+
+NOMATCH-CHECK-NOT: {{.}}
+RUN: clang-diff %S/clang-diff-ast.cpp %S/clang-diff-ast.cpp -- 2>&1 -std=c++11 \
+RUN: | FileCheck -check-prefix=NOMATCH-CHECK -allow-empty %s
Index: cfe/trunk/test/Tooling/clang-diff-basic.cpp
===================================================================
--- cfe/trunk/test/Tooling/clang-diff-basic.cpp
+++ cfe/trunk/test/Tooling/clang-diff-basic.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 %t.src.cpp %t.dst.cpp -- | FileCheck %s
+// RUN: clang-diff -dump-matches %t.src.cpp %t.dst.cpp -- | FileCheck %s
#ifndef DEST
namespace src {
Index: cfe/trunk/tools/clang-diff/ClangDiff.cpp
===================================================================
--- cfe/trunk/tools/clang-diff/ClangDiff.cpp
+++ cfe/trunk/tools/clang-diff/ClangDiff.cpp
@@ -33,6 +33,10 @@
cl::desc("Print the internal representation of the AST as JSON."),
cl::init(false), cl::cat(ClangDiffCategory));
+static cl::opt<bool>
+ PrintMatches("dump-matches", cl::desc("Print the matched nodes."),
+ cl::init(false), cl::cat(ClangDiffCategory));
+
static cl::opt<std::string> SourcePath(cl::Positional, cl::desc("<source>"),
cl::Required,
cl::cat(ClangDiffCategory));
@@ -267,7 +271,7 @@
for (diff::NodeId Dst : DstTree) {
diff::NodeId Src = Diff.getMapped(DstTree, Dst);
- if (Src.isValid()) {
+ if (PrintMatches && Src.isValid()) {
llvm::outs() << "Match ";
printNode(llvm::outs(), SrcTree, Src);
llvm::outs() << " to ";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36181.111815.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170819/7f5fa891/attachment.bin>
More information about the cfe-commits
mailing list