================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to