diff --git a/cranelift/module/src/module.rs b/cranelift/module/src/module.rs index 26704ae5e5..58ddb2aa76 100644 --- a/cranelift/module/src/module.rs +++ b/cranelift/module/src/module.rs @@ -210,6 +210,11 @@ impl ModuleDeclarations { self.names.get(name).copied() } + /// Get an iterator of all function declarations + pub fn get_functions(&self) -> impl Iterator { + self.functions.iter() + } + /// Get the `FuncId` for the function named by `name`. pub fn get_function_id(&self, name: &ir::ExternalName) -> FuncId { if let ir::ExternalName::User { namespace, index } = *name { @@ -235,6 +240,11 @@ impl ModuleDeclarations { &self.functions[func_id] } + /// Get an iterator of all data declarations + pub fn get_data_objects(&self) -> impl Iterator { + self.data_objects.iter() + } + /// Get the `DataDeclaration` for the data object named by `name`. pub fn get_data_decl(&self, data_id: DataId) -> &DataDeclaration { &self.data_objects[data_id]