Skip to content

Commit 22316d1

Browse files
authored
Include symtab2gb conversion in --only-codegen (#1585)
#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.
1 parent 5574f5d commit 22316d1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kani-driver/src/main.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ fn cargokani_main(input_args: Vec<OsString>) -> Result<()> {
4040
let ctx = session::KaniSession::new(args.common_opts)?;
4141

4242
let outputs = ctx.cargo_build()?;
43-
if ctx.args.only_codegen {
44-
return Ok(());
45-
}
43+
4644
let mut goto_objs: Vec<PathBuf> = Vec::new();
4745
for symtab in &outputs.symtabs {
4846
goto_objs.push(ctx.symbol_table_to_gotoc(symtab)?);
4947
}
5048

49+
if ctx.args.only_codegen {
50+
return Ok(());
51+
}
52+
5153
let linked_obj = outputs.outdir.join("cbmc-linked.out");
5254
ctx.link_goto_binary(&goto_objs, &linked_obj)?;
5355
if let Some(restrictions) = outputs.restrictions {
@@ -87,10 +89,12 @@ fn standalone_main() -> Result<()> {
8789
let ctx = session::KaniSession::new(args.common_opts)?;
8890

8991
let outputs = ctx.compile_single_rust_file(&args.input)?;
92+
93+
let goto_obj = ctx.symbol_table_to_gotoc(&outputs.symtab)?;
94+
9095
if ctx.args.only_codegen {
9196
return Ok(());
9297
}
93-
let goto_obj = ctx.symbol_table_to_gotoc(&outputs.symtab)?;
9498

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

0 commit comments

Comments
 (0)