diff --git a/Tools/run-clang-tidy.py b/Tools/run-clang-tidy.py index 4f29868bee..764edd6581 100755 --- a/Tools/run-clang-tidy.py +++ b/Tools/run-clang-tidy.py @@ -144,6 +144,8 @@ def main(): help='number of tidy instances to be run in parallel.') parser.add_argument('files', nargs='*', default=['.*'], help='files to be processed (regex on path)') + parser.add_argument('-exclude', dest='exclude', default=None, + help='regular expression matching files to exclude') parser.add_argument('-fix', action='store_true', help='apply fix-its') parser.add_argument('-format', action='store_true', help='Reformat code ' 'after applying fixes') @@ -192,6 +194,7 @@ def main(): # Build up a big regexy filter from all command line arguments. file_name_re = re.compile('(' + ')|('.join(args.files) + ')') + exclude_re = re.compile(args.exclude) if args.exclude else None try: # Spin up a bunch of tidy-launching threads. @@ -205,6 +208,8 @@ def main(): # Fill the queue with files. for name in files: if file_name_re.search(name): + if exclude_re and exclude_re.search(name): + continue queue.put(name) # Wait for all threads to be done.