From 90352ad83a34988d0e1420ab8560eabc561b5a9f Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sun, 12 Nov 2023 11:13:38 +0530 Subject: [PATCH 1/3] Support the --no-loc flag --- src/bin/lpython.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/lpython.cpp b/src/bin/lpython.cpp index 1cb8d2556e..573007f4f2 100644 --- a/src/bin/lpython.cpp +++ b/src/bin/lpython.cpp @@ -225,9 +225,9 @@ int emit_asr(const std::string &infile, std::cout << LCompilers::pickle_tree(*asr, compiler_options.use_colors, with_intrinsic_modules) << std::endl; } else if (compiler_options.po.json) { - std::cout << LCompilers::pickle_json(*asr, lm, false, with_intrinsic_modules) << std::endl; + std::cout << LCompilers::pickle_json(*asr, lm, compiler_options.po.no_loc, with_intrinsic_modules) << std::endl; } else if (compiler_options.po.visualize) { - std::string astr_data_json = LCompilers::pickle_json(*asr, lm, false, with_intrinsic_modules); + std::string astr_data_json = LCompilers::pickle_json(*asr, lm, compiler_options.po.no_loc, with_intrinsic_modules); return visualize_json(astr_data_json, compiler_options.platform); } else { std::cout << LCompilers::pickle(*asr, compiler_options.use_colors, @@ -1571,6 +1571,7 @@ int main(int argc, char *argv[]) app.add_flag("--no-indent", arg_no_indent, "Turn off Indented print ASR/AST"); app.add_flag("--tree", compiler_options.po.tree, "Tree structure print ASR/AST"); app.add_flag("--json", compiler_options.po.json, "Print ASR/AST Json format"); + app.add_flag("--no-loc", compiler_options.po.no_loc, "Skip location information in ASR/AST Json format"); app.add_flag("--visualize", compiler_options.po.visualize, "Print ASR/AST Visualization"); app.add_option("--pass", arg_pass, "Apply the ASR pass and show ASR (implies --show-asr)"); app.add_option("--skip-pass", skip_pass, "Skip an ASR pass in default pipeline"); From 2fd564c988245b564d51b07dfa83d17dbbdcf78e Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sun, 12 Nov 2023 11:36:14 +0530 Subject: [PATCH 2/3] Reuse compiler_options.po for pass_options --- src/bin/lpython.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/bin/lpython.cpp b/src/bin/lpython.cpp index 573007f4f2..6f0fc85b24 100644 --- a/src/bin/lpython.cpp +++ b/src/bin/lpython.cpp @@ -365,18 +365,11 @@ int emit_c_to_file(const std::string &infile, const std::string &outfile, } LCompilers::ASR::TranslationUnit_t* asr = r1.result; - // Apply ASR passes - LCompilers::PassOptions pass_options; + compiler_options.po.run_fun = "f"; + compiler_options.po.always_run = true; + pass_manager.use_default_passes(true); - pass_options.run_fun = "f"; - pass_options.always_run = true; - pass_options.verbose = compiler_options.po.verbose; - pass_options.all_symbols_mangling = compiler_options.po.all_symbols_mangling; - pass_options.module_name_mangling = compiler_options.po.module_name_mangling; - pass_options.global_symbols_mangling = compiler_options.po.global_symbols_mangling; - pass_options.intrinsic_symbols_mangling = compiler_options.po.intrinsic_symbols_mangling; - - pass_manager.apply_passes(al, asr, pass_options, diagnostics); + pass_manager.apply_passes(al, asr, compiler_options.po, diagnostics); diagnostics.diagnostics.clear(); auto res = LCompilers::asr_to_c(al, *asr, diagnostics, compiler_options, 0); From 8efef3cf6bfcd5a5709c681fb373ace5f44e12ac Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sun, 12 Nov 2023 13:38:23 +0530 Subject: [PATCH 3/3] GIT: Ignore generated files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 85bac5da5a..267f5ee03c 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,10 @@ integration_tests/b5/* integration_tests/b6/* integration_tests/_lpython-tmp-test-* inst/bin/* +*.clj +pass_fortran_*.f90 +pass_json_*.json +pass_tree_*.txt *.tmp *.tlog *.filters