Skip to content

Commit ecc00e8

Browse files
committed
Add -config option run run_O2CodeChecker and propagate to invocation
1 parent edddcdd commit ecc00e8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tool/run_O2CodeChecker.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def find_compilation_database(path):
5959

6060

6161
def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
62-
header_filter):
62+
header_filter, config):
6363
"""Gets a command line for clang-tidy."""
6464
start = [clang_tidy_binary]
6565
if header_filter is not None:
@@ -69,6 +69,8 @@ def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
6969
start.append('-header-filter=^' + build_path + '/.*')
7070
if checks:
7171
start.append('-checks=' + checks)
72+
if config:
73+
start.append('-config=' + config)
7274
if tmpdir is not None:
7375
start.append('-export-fixes')
7476
# Get a temporary file. We immediately close the handle so clang-tidy can
@@ -96,7 +98,7 @@ def run_tidy(args, tmpdir, build_path, queue):
9698
while True:
9799
name = queue.get()
98100
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
99-
tmpdir, build_path, args.header_filter)
101+
tmpdir, build_path, args.header_filter, args.config)
100102
sys.stdout.write(' '.join(invocation) + '\n')
101103
subprocess.call(invocation)
102104
queue.task_done()
@@ -116,6 +118,9 @@ def main():
116118
parser.add_argument('-checks', default=None,
117119
help='checks filter, when not specified, use clang-tidy '
118120
'default')
121+
parser.add_argument('-config', default=None,
122+
help='config option for check , when not specified, use clang-tidy '
123+
'default')
119124
parser.add_argument('-header-filter', default=None,
120125
help='regular expression matching the names of the '
121126
'headers to output diagnostics from. Diagnostics from '
@@ -143,6 +148,8 @@ def main():
143148
try:
144149
invocation = [args.clang_tidy_binary, '-list-checks']
145150
invocation.append('-p=' + build_path)
151+
if args.config:
152+
invocation.append('-config=' + args.config)
146153
if args.checks:
147154
invocation.append('-checks=' + args.checks)
148155
invocation.append('-')

0 commit comments

Comments
 (0)