Skip to content

Commit 64b1391

Browse files
authored
Merge pull request #2418 from Shaikh-Ubaid/pass_options
Minor fixes related to Pass options
2 parents a8dbbc2 + 8efef3c commit 64b1391

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ integration_tests/b5/*
7373
integration_tests/b6/*
7474
integration_tests/_lpython-tmp-test-*
7575
inst/bin/*
76+
*.clj
77+
pass_fortran_*.f90
78+
pass_json_*.json
79+
pass_tree_*.txt
7680
*.tmp
7781
*.tlog
7882
*.filters

src/bin/lpython.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ int emit_asr(const std::string &infile,
225225
std::cout << LCompilers::pickle_tree(*asr,
226226
compiler_options.use_colors, with_intrinsic_modules) << std::endl;
227227
} else if (compiler_options.po.json) {
228-
std::cout << LCompilers::pickle_json(*asr, lm, false, with_intrinsic_modules) << std::endl;
228+
std::cout << LCompilers::pickle_json(*asr, lm, compiler_options.po.no_loc, with_intrinsic_modules) << std::endl;
229229
} else if (compiler_options.po.visualize) {
230-
std::string astr_data_json = LCompilers::pickle_json(*asr, lm, false, with_intrinsic_modules);
230+
std::string astr_data_json = LCompilers::pickle_json(*asr, lm, compiler_options.po.no_loc, with_intrinsic_modules);
231231
return visualize_json(astr_data_json, compiler_options.platform);
232232
} else {
233233
std::cout << LCompilers::pickle(*asr, compiler_options.use_colors,
@@ -365,18 +365,11 @@ int emit_c_to_file(const std::string &infile, const std::string &outfile,
365365
}
366366
LCompilers::ASR::TranslationUnit_t* asr = r1.result;
367367

368-
// Apply ASR passes
369-
LCompilers::PassOptions pass_options;
370-
pass_manager.use_default_passes(true);
371-
pass_options.run_fun = "f";
372-
pass_options.always_run = true;
373-
pass_options.verbose = compiler_options.po.verbose;
374-
pass_options.all_symbols_mangling = compiler_options.po.all_symbols_mangling;
375-
pass_options.module_name_mangling = compiler_options.po.module_name_mangling;
376-
pass_options.global_symbols_mangling = compiler_options.po.global_symbols_mangling;
377-
pass_options.intrinsic_symbols_mangling = compiler_options.po.intrinsic_symbols_mangling;
368+
compiler_options.po.run_fun = "f";
369+
compiler_options.po.always_run = true;
378370

379-
pass_manager.apply_passes(al, asr, pass_options, diagnostics);
371+
pass_manager.use_default_passes(true);
372+
pass_manager.apply_passes(al, asr, compiler_options.po, diagnostics);
380373

381374
diagnostics.diagnostics.clear();
382375
auto res = LCompilers::asr_to_c(al, *asr, diagnostics, compiler_options, 0);
@@ -1571,6 +1564,7 @@ int main(int argc, char *argv[])
15711564
app.add_flag("--no-indent", arg_no_indent, "Turn off Indented print ASR/AST");
15721565
app.add_flag("--tree", compiler_options.po.tree, "Tree structure print ASR/AST");
15731566
app.add_flag("--json", compiler_options.po.json, "Print ASR/AST Json format");
1567+
app.add_flag("--no-loc", compiler_options.po.no_loc, "Skip location information in ASR/AST Json format");
15741568
app.add_flag("--visualize", compiler_options.po.visualize, "Print ASR/AST Visualization");
15751569
app.add_option("--pass", arg_pass, "Apply the ASR pass and show ASR (implies --show-asr)");
15761570
app.add_option("--skip-pass", skip_pass, "Skip an ASR pass in default pipeline");

0 commit comments

Comments
 (0)