[PATCH] D43538: [clang-tidy] Update run-clang-tidy.py with config arg
Julie Hockett via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 20 16:57:57 PST 2018
juliehockett created this revision.
juliehockett added reviewers: aaron.ballman, hokein, alexfh.
juliehockett added a project: clang-tools-extra.
Herald added a subscriber: xazax.hun.
Updating the run-clang-tidy.py script to allow specification of the config argument to the clang-tidy invocation.
https://reviews.llvm.org/D43538
Files:
clang-tidy/tool/run-clang-tidy.py
Index: clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tidy/tool/run-clang-tidy.py
+++ clang-tidy/tool/run-clang-tidy.py
@@ -75,7 +75,8 @@
def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
- header_filter, extra_arg, extra_arg_before, quiet):
+ header_filter, extra_arg, extra_arg_before, quiet,
+ config):
"""Gets a command line for clang-tidy."""
start = [clang_tidy_binary]
if header_filter is not None:
@@ -99,6 +100,8 @@
start.append('-p=' + build_path)
if quiet:
start.append('-quiet')
+ if config:
+ start.append('-config=' + config)
start.append(f)
return start
@@ -157,7 +160,7 @@
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
tmpdir, build_path, args.header_filter,
args.extra_arg, args.extra_arg_before,
- args.quiet)
+ args.quiet, args.config)
sys.stdout.write(' '.join(invocation) + '\n')
subprocess.call(invocation)
queue.task_done()
@@ -177,6 +180,14 @@
parser.add_argument('-checks', default=None,
help='checks filter, when not specified, use clang-tidy '
'default')
+ parser.add_argument('-config', default=None,
+ help='Specifies a configuration in YAML/JSON format: '
+ ' -config="{Checks: \'*\','
+ ' CheckOptions: [{key: x,'
+ ' value: y}]}"'
+ 'When the value is empty, clang-tidy will'
+ 'attempt to find a file named .clang-tidy for'
+ 'each source file in its parent directories.')
parser.add_argument('-header-filter', default=None,
help='regular expression matching the names of the '
'headers to output diagnostics from. Diagnostics from '
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43538.135174.patch
Type: text/x-patch
Size: 2171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180221/0593b590/attachment.bin>
More information about the cfe-commits
mailing list