[PATCH] D29806: [clang-tidy] Add -path option to clang-tidy-diff.py
Ehsan Akhgari via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 17 14:32:17 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL295482: [clang-tidy] Add -path option to clang-tidy-diff.py (authored by ehsan).
Changed prior to commit:
https://reviews.llvm.org/D29806?vs=88879&id=88959#toc
Repository:
rL LLVM
https://reviews.llvm.org/D29806
Files:
clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
Index: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
@@ -2,6 +2,9 @@
// RUN: clang-tidy -checks=-*,modernize-use-override %t.cpp -- -std=c++11 | FileCheck -check-prefix=CHECK-SANITY %s
// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s
// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -quiet -- -std=c++11 2>&1 | FileCheck -check-prefix=CHECK-QUIET %s
+// RUN: mkdir -p %T/compilation-database-test/
+// RUN: echo '[{"directory": "%T", "command": "clang++ -o test.o -std=c++11 %t.cpp", "file": "%t.cpp"}]' > %T/compilation-database-test/compile_commands.json
+// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -path %T/compilation-database-test 2>&1 | FileCheck -check-prefix=CHECK %s
struct A {
virtual void f() {}
virtual void g() {}
Index: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
===================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
@@ -55,6 +55,8 @@
help='checks filter, when not specified, use clang-tidy '
'default',
default='')
+ parser.add_argument('-path', dest='build_path',
+ help='Path used to read a compile command database.')
parser.add_argument('-extra-arg', dest='extra_arg',
action='append', default=[],
help='Additional argument to append to the compiler '
@@ -124,6 +126,8 @@
command.append('-checks=' + quote + args.checks + quote)
if args.quiet:
command.append('-quiet')
+ if args.build_path is not None:
+ command.append('-p=%s' % args.build_path)
command.extend(lines_by_file.keys())
for arg in args.extra_arg:
command.append('-extra-arg=%s' % arg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29806.88959.patch
Type: text/x-patch
Size: 2159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170217/7a278482/attachment-0001.bin>
More information about the cfe-commits
mailing list