@@ -58,7 +58,7 @@ def find_compilation_database(path):
5858 return os .path .realpath (result )
5959
6060
61- def get_tidy_invocation (f , clang_tidy_binary , checks , tmpdir , build_path ,
61+ def get_tidy_invocation (f , clang_tidy_binary , checks , warningsAsErrors , tmpdir , build_path ,
6262 header_filter , config ):
6363 """Gets a command line for clang-tidy."""
6464 start = [clang_tidy_binary ]
@@ -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 warningsAsErrors :
73+ start .append ('-warnings-as-errors=' + warningsAsErrors )
7274 if config :
7375 start .append ('-config=' + config )
7476 if tmpdir is not None :
@@ -97,7 +99,7 @@ def run_tidy(args, tmpdir, build_path, queue):
9799 """Takes filenames out of queue and runs clang-tidy on them."""
98100 while True :
99101 name = queue .get ()
100- invocation = get_tidy_invocation (name , args .clang_tidy_binary , args .checks ,
102+ invocation = get_tidy_invocation (name , args .clang_tidy_binary , args .checks , args . warningsAsErrors ,
101103 tmpdir , build_path , args .header_filter , args .config )
102104 sys .stdout .write (' ' .join (invocation ) + '\n ' )
103105 subprocess .call (invocation )
@@ -118,6 +120,9 @@ def main():
118120 parser .add_argument ('-checks' , default = None ,
119121 help = 'checks filter, when not specified, use clang-tidy '
120122 'default' )
123+ parser .add_argument ('-warnings-as-errors' , default = None ,
124+ help = 'checks which should become errors when triggered '
125+ 'default' )
121126 parser .add_argument ('-config' , default = None ,
122127 help = 'config option for check , when not specified, use clang-tidy '
123128 'default' )
0 commit comments