[clang-tidy] run-clang-tidy.py: analyze unique files only
authorSerikzhan Kazi <se7kazi@gmail.com>
Sat, 6 Nov 2021 06:53:18 +0000 (19:53 +1300)
committerSalman Javed <mail@salmanjaved.org>
Sat, 6 Nov 2021 06:53:18 +0000 (19:53 +1300)
The files in compile-commands.json can potentially include duplicates.
Change run-clang-tidy.py so that it does not run on the duplicate entries.

Differential Revision: https://reviews.llvm.org/D112926

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

index acd1ed6..e6cff6a 100755 (executable)
@@ -273,8 +273,8 @@ def main():
 
   # Load the database and extract all files.
   database = json.load(open(os.path.join(build_path, db_path)))
-  files = [make_absolute(entry['file'], entry['directory'])
-           for entry in database]
+  files = set([make_absolute(entry['file'], entry['directory'])
+           for entry in database])
 
   max_task = args.j
   if max_task == 0: