woodruffw / mollusc

Pure-Rust libraries for parsing, interpreting, and analyzing LLVM
MIT License
77 stars 6 forks source link

Rethink the top-level unrolled block and record APIs #21

Closed woodruffw closed 2 years ago

woodruffw commented 2 years ago

llvm_mapper::unroll::UnrolledBlock currently has a bunch of APIs with signatures that look roughly like this:

pub fn one_record(&self, code: u64) -> Result<&UnrolledRecord, BlockMapError> { ... }
pub fn one_block(&self, id: BlockId) -> Result<&UnrolledBlock, BlockMapError> { ... }

These are convenient in each record/block mapping implementation, but they're also constraining: because they return BlockMapError as their error type, downstream types need to either accept that type (e.g. with thiserror's #[from]) or mangle it into something more local and context sensitive. This in turn makes it harder to make the mapping traits more flexible in terms of error handling.

woodruffw commented 2 years ago

20.