Skip to content

Commit

Permalink
Deduplicate clang-tidy file names to check. (#17149)
Browse files Browse the repository at this point in the history
Unified builds may compile the same file several times, which
results in slower clang-tidy (specifically darwin runs everything
twice: once for gcc_x64 and once for standalone).

Even though arguments may be different, this should not have a
significant enough impact on tidy results. If we want to run
with specific arguments, we can run on a more focused compile
database or update the script to allow skipping the dedup.
  • Loading branch information
andy31415 authored Apr 7, 2022
1 parent 845b38d commit d56fca1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/run-clang-tidy-on-compile-commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def __init__(self):
self.fixes_file = None
self.fixes_temporary_file_dir = None
self.gcc_sysroot = None
self.file_names_to_check = set()

if sys.platform == 'darwin':
# Darwin gcc invocation will auto select a system root, however clang requires an explicit path since
Expand All @@ -206,6 +207,11 @@ def AddDatabase(self, compile_commands_json):
if not item.valid:
continue

if item.file in self.file_names_to_check:
logging.info('Ignoring additional request for checking %s', item.file)
continue

self.file_names_to_check.add(item.file)
self.entries.append(item)

def Cleanup(self):
Expand Down

0 comments on commit d56fca1

Please sign in to comment.