[clang-tools-extra] 0dc856e - [clang-tidy] run-clang-tidy.py: analyze unique files only

Salman Javed via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 5 23:54:21 PDT 2021


Author: Serikzhan Kazi
Date: 2021-11-06T19:53:18+13:00
New Revision: 0dc856ed20e0fb64dd7cb0a10db35c58c3ef95e6

URL: https://github.com/llvm/llvm-project/commit/0dc856ed20e0fb64dd7cb0a10db35c58c3ef95e6
DIFF: https://github.com/llvm/llvm-project/commit/0dc856ed20e0fb64dd7cb0a10db35c58c3ef95e6.diff

LOG: [clang-tidy] run-clang-tidy.py: analyze unique files only

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index acd1ed6979c0d..e6cff6a7414d1 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -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:


        


More information about the cfe-commits mailing list