pub struct ModuleDeclarations { /* private fields */ }
Expand description
This provides a view to the state of a module which allows ir::ExternalName
s to be translated
into FunctionDeclaration
s and DataDeclaration
s.
Implementations§
Source§impl ModuleDeclarations
impl ModuleDeclarations
Sourcepub fn get_name(&self, name: &str) -> Option<FuncOrDataId>
pub fn get_name(&self, name: &str) -> Option<FuncOrDataId>
Get the module identifier for a given name, if that name has been declared.
Sourcepub fn get_functions(
&self,
) -> impl Iterator<Item = (FuncId, &FunctionDeclaration)>
pub fn get_functions( &self, ) -> impl Iterator<Item = (FuncId, &FunctionDeclaration)>
Get an iterator of all function declarations
Sourcepub fn is_function(name: &ModuleRelocTarget) -> bool
pub fn is_function(name: &ModuleRelocTarget) -> bool
Return whether name
names a function, rather than a data object.
Sourcepub fn get_function_decl(&self, func_id: FuncId) -> &FunctionDeclaration
pub fn get_function_decl(&self, func_id: FuncId) -> &FunctionDeclaration
Get the FunctionDeclaration
for the function named by name
.
Sourcepub fn get_data_objects(
&self,
) -> impl Iterator<Item = (DataId, &DataDeclaration)>
pub fn get_data_objects( &self, ) -> impl Iterator<Item = (DataId, &DataDeclaration)>
Get an iterator of all data declarations
Sourcepub fn get_data_decl(&self, data_id: DataId) -> &DataDeclaration
pub fn get_data_decl(&self, data_id: DataId) -> &DataDeclaration
Get the DataDeclaration
for the data object named by name
.
Sourcepub fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature,
) -> ModuleResult<(FuncId, Linkage)>
pub fn declare_function( &mut self, name: &str, linkage: Linkage, signature: &Signature, ) -> ModuleResult<(FuncId, Linkage)>
Declare a function in this module.
Sourcepub fn declare_anonymous_function(
&mut self,
signature: &Signature,
) -> ModuleResult<FuncId>
pub fn declare_anonymous_function( &mut self, signature: &Signature, ) -> ModuleResult<FuncId>
Declare an anonymous function in this module.
Sourcepub fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool,
tls: bool,
) -> ModuleResult<(DataId, Linkage)>
pub fn declare_data( &mut self, name: &str, linkage: Linkage, writable: bool, tls: bool, ) -> ModuleResult<(DataId, Linkage)>
Declare a data object in this module.
Sourcepub fn declare_anonymous_data(
&mut self,
writable: bool,
tls: bool,
) -> ModuleResult<DataId>
pub fn declare_anonymous_data( &mut self, writable: bool, tls: bool, ) -> ModuleResult<DataId>
Declare an anonymous data object in this module.
Trait Implementations§
Source§impl Debug for ModuleDeclarations
impl Debug for ModuleDeclarations
Source§impl Default for ModuleDeclarations
impl Default for ModuleDeclarations
Source§fn default() -> ModuleDeclarations
fn default() -> ModuleDeclarations
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModuleDeclarations
impl RefUnwindSafe for ModuleDeclarations
impl Send for ModuleDeclarations
impl Sync for ModuleDeclarations
impl Unpin for ModuleDeclarations
impl UnwindSafe for ModuleDeclarations
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more