[solidity,llvm-context] Improve support for debugging the compiler (#32)

Add option --recursive-process-input <filename> for use with
--recursive-process to specify the name of a file to use instead of
reading from stdin.

If --debug-output-dir is set, dump the file passed to the recursive
invocation of the compiler as a JSON file suitable for use with
--recursive-process-input.

These changes are intended to support debugging the compiler and are
only available with DEBUG builds.
This commit is contained in:
wpt967
2024-08-23 17:18:07 +01:00
committed by GitHub
parent 184d40d377
commit bb4a4dddde
5 changed files with 77 additions and 3 deletions
+7 -1
View File
@@ -47,7 +47,13 @@ fn main_inner() -> anyhow::Result<()> {
revive_llvm_context::initialize_target(revive_llvm_context::Target::PVM); // TODO: pass from CLI
if arguments.recursive_process {
return revive_solidity::run_process();
#[cfg(debug_assertions)]
if let Some(fname) = arguments.recursive_process_input {
let mut infile = std::fs::File::open(fname)?;
return revive_solidity::run_process(Some(&mut infile));
}
return revive_solidity::run_process(None);
}
let debug_config = match arguments.debug_output_directory {