[clang-tools-extra] [clang-tidy] Add an option to exclude files not present in the compile database (PR #120348)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 23 13:05:20 PST 2024
================
@@ -124,6 +125,19 @@ def merge_replacement_files(tmpdir, mergefile):
open(mergefile, "w").close()
+def get_compiling_file_list(compiledb : Path) -> list[Path]:
+ """ Read a compile_commands.json database and return a list of file paths """
+ file_list = []
+ with open(compiledb) as db_file:
+ db_json = json.load(db_file)
+ for entry in db_json:
+ if "file" not in entry:
+ continue
+ if entry["file"] not in file_list:
+ file_list.append(Path(entry["file"]))
+ return file_list
----------------
wonbinbk wrote:
Thanks for the suggestion! A set would be more suitable. Applied.
https://github.com/llvm/llvm-project/pull/120348
More information about the cfe-commits
mailing list