forked from OSchip/llvm-project
[clang-tidy] Update run-clang-tidy.py with config arg
Updating the run-clang-tidy.py script to allow specification of the config argument to the clang-tidy invocation. Differential Revision: https://reviews.llvm.org/D43538 llvm-svn: 327186
This commit is contained in:
parent
0c51c94b00
commit
c3716ca219
|
@ -75,7 +75,8 @@ def make_absolute(f, directory):
|
|||
|
||||
|
||||
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 @@ def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
|
|||
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 @@ def run_tidy(args, tmpdir, build_path, queue):
|
|||
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 @@ def main():
|
|||
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 '
|
||||
|
|
Loading…
Reference in New Issue