[clang] c0cd527 - [ast-dump-tool] fix regression if --empty-implementation but --json-input-path is not

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 15 05:48:37 PDT 2021


Author: Nico Weber
Date: 2021-03-15T08:48:26-04:00
New Revision: c0cd5274ccdbe57edb20b0375b73a75c70a48882

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

LOG: [ast-dump-tool] fix regression if --empty-implementation but --json-input-path is not

Looks like this broke in one of the relands of
https://reviews.llvm.org/D93164

Added: 
    

Modified: 
    clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
index 054cae6e78f2..b4d31d3e49a9 100755
--- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
+++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
@@ -156,14 +156,16 @@ def main():
 
     use_empty_implementation = options.empty_implementation
 
-    if not os.path.exists(options.json_input_path):
-      use_empty_implementation = True
+    if (not use_empty_implementation
+            and not os.path.exists(options.json_input_path)):
+        use_empty_implementation = True
 
-    with open(options.json_input_path) as f:
-        jsonData = json.load(f)
+    if not use_empty_implementation:
+        with open(options.json_input_path) as f:
+            jsonData = json.load(f)
 
-    if not 'classesInClade' in jsonData or not jsonData["classesInClade"]:
-      use_empty_implementation = True
+        if not 'classesInClade' in jsonData or not jsonData["classesInClade"]:
+            use_empty_implementation = True
 
     if use_empty_implementation:
         with open(os.path.join(os.getcwd(),


        


More information about the cfe-commits mailing list