use inkwell's FunctionIterator

This commit is contained in:
Folkert 2022-11-13 14:51:24 +01:00
parent b907f01f1f
commit 031866799a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 2 additions and 32 deletions

View file

@ -91,34 +91,6 @@ macro_rules! debug_info_init {
}};
}
/// Iterate over all functions in an llvm module
pub struct FunctionIterator<'ctx> {
next: Option<FunctionValue<'ctx>>,
}
impl<'ctx> FunctionIterator<'ctx> {
pub fn from_module(module: &inkwell::module::Module<'ctx>) -> Self {
Self {
next: module.get_first_function(),
}
}
}
impl<'ctx> Iterator for FunctionIterator<'ctx> {
type Item = FunctionValue<'ctx>;
fn next(&mut self) -> Option<Self::Item> {
match self.next {
Some(function) => {
self.next = function.get_next_function();
Some(function)
}
None => None,
}
}
}
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Scope<'a, 'ctx> {
symbols: ImMap<Symbol, (Layout<'a>, BasicValueEnum<'ctx>)>,