33
44//! This file contains the code necessary to interface with the compiler backend
55
6+ use crate :: context:: metadata:: RmcMetadata ;
67use crate :: GotocCtx ;
7-
88use bitflags:: _core:: any:: Any ;
99use cbmc:: goto_program:: symtab_transformer;
1010use cbmc:: goto_program:: SymbolTable ;
@@ -29,9 +29,10 @@ use tracing::{debug, warn};
2929
3030// #[derive(RustcEncodable, RustcDecodable)]
3131pub struct GotocCodegenResult {
32- pub type_map : BTreeMap < InternedString , InternedString > ,
33- pub symtab : SymbolTable ,
3432 pub crate_name : rustc_span:: Symbol ,
33+ pub metadata : RmcMetadata ,
34+ pub symtab : SymbolTable ,
35+ pub type_map : BTreeMap < InternedString , InternedString > ,
3536 pub vtable_restrictions : Option < VtableCtxResults > ,
3637}
3738
@@ -128,7 +129,7 @@ impl CodegenBackend for GotocCodegenBackend {
128129 }
129130
130131 // perform post-processing symbol table passes
131- let symbol_table = symtab_transformer:: do_passes (
132+ let symtab = symtab_transformer:: do_passes (
132133 c. symbol_table ,
133134 & tcx. sess . opts . debugging_opts . symbol_table_passes ,
134135 ) ;
@@ -144,11 +145,14 @@ impl CodegenBackend for GotocCodegenBackend {
144145 None
145146 } ;
146147
148+ let metadata = RmcMetadata { proof_harnesses : c. proof_harnesses } ;
149+
147150 Box :: new ( GotocCodegenResult {
148- type_map,
149- symtab : symbol_table,
150151 crate_name : tcx. crate_name ( LOCAL_CRATE ) as rustc_span:: Symbol ,
151- vtable_restrictions : vtable_restrictions,
152+ metadata,
153+ symtab,
154+ type_map,
155+ vtable_restrictions,
152156 } )
153157 }
154158
@@ -176,7 +180,7 @@ impl CodegenBackend for GotocCodegenBackend {
176180 let base_filename = outputs. path ( OutputType :: Object ) ;
177181 write_file ( & base_filename, "symtab.json" , & result. symtab ) ;
178182 write_file ( & base_filename, "type_map.json" , & result. type_map ) ;
179-
183+ write_file ( & base_filename , "rmc-metadata.json" , & result . metadata ) ;
180184 // If they exist, write out vtable virtual call function pointer restrictions
181185 if let Some ( restrictions) = result. vtable_restrictions {
182186 write_file ( & base_filename, "restrictions.json" , & restrictions) ;
0 commit comments