Skip to content

Commit

Permalink
Include symtab2gb conversion in --only-codegen (#1585)
Browse files Browse the repository at this point in the history
#957 will need more fixes and discussions to be enabled. In the meantime, this PR includes the symtab2gb conversion step in --only-codegen runs, so that Kani fails if the conversion from Kani-generated symbol tables to GotoC program is invalid.
  • Loading branch information
adpaco-aws authored Aug 25, 2022
1 parent 5574f5d commit 22316d1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions kani-driver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ fn cargokani_main(input_args: Vec<OsString>) -> Result<()> {
let ctx = session::KaniSession::new(args.common_opts)?;

let outputs = ctx.cargo_build()?;
if ctx.args.only_codegen {
return Ok(());
}

let mut goto_objs: Vec<PathBuf> = Vec::new();
for symtab in &outputs.symtabs {
goto_objs.push(ctx.symbol_table_to_gotoc(symtab)?);
}

if ctx.args.only_codegen {
return Ok(());
}

let linked_obj = outputs.outdir.join("cbmc-linked.out");
ctx.link_goto_binary(&goto_objs, &linked_obj)?;
if let Some(restrictions) = outputs.restrictions {
Expand Down Expand Up @@ -87,10 +89,12 @@ fn standalone_main() -> Result<()> {
let ctx = session::KaniSession::new(args.common_opts)?;

let outputs = ctx.compile_single_rust_file(&args.input)?;

let goto_obj = ctx.symbol_table_to_gotoc(&outputs.symtab)?;

if ctx.args.only_codegen {
return Ok(());
}
let goto_obj = ctx.symbol_table_to_gotoc(&outputs.symtab)?;

let linked_obj = util::alter_extension(&args.input, "out");
{
Expand Down

0 comments on commit 22316d1

Please sign in to comment.