From d56fca19d1a417054831129dadc3314ebe4b709e Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 7 Apr 2022 04:32:04 -1000 Subject: [PATCH] Deduplicate clang-tidy file names to check. (#17149) 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. --- scripts/run-clang-tidy-on-compile-commands.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/run-clang-tidy-on-compile-commands.py b/scripts/run-clang-tidy-on-compile-commands.py index 9777fe73eaf592..7d51325d7ba22f 100755 --- a/scripts/run-clang-tidy-on-compile-commands.py +++ b/scripts/run-clang-tidy-on-compile-commands.py @@ -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 @@ -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):