cranelift-module: expose trap information when defining functions

The current interface of `cranelift-module` requires consumers who want
to be informed about traps to discover that information through
`Module::Product`, which is backend-specific.  Since it's advantageous
to manipulate this information in a backend-agnostic way, this patch
changes `Module::define_function{,_bytes}` to return information about
the traps contained in the function being defined.
This commit is contained in:
Nathan Froyd
2020-03-03 11:27:45 -05:00
parent f7c2a58d23
commit 0f49a830c9
6 changed files with 60 additions and 37 deletions

View File

@@ -59,7 +59,8 @@ impl FaerieTrapManifest {
}
/// Put a `FaerieTrapSink` into manifest
pub fn add_sink(&mut self, sink: FaerieTrapSink) {
pub fn add_sink(&mut self, sink: FaerieTrapSink) -> &Vec<TrapSite> {
self.sinks.push(sink);
&self.sinks.last().unwrap().sites
}
}