Struct inkwell::values::GlobalValue
source · pub struct GlobalValue<'ctx> { /* private fields */ }
Implementations§
source§impl<'ctx> GlobalValue<'ctx>
impl<'ctx> GlobalValue<'ctx>
sourcepub unsafe fn new(value: LLVMValueRef) -> Self
pub unsafe fn new(value: LLVMValueRef) -> Self
pub fn get_previous_global(self) -> Option<GlobalValue<'ctx>>
pub fn get_next_global(self) -> Option<GlobalValue<'ctx>>
pub fn get_dll_storage_class(self) -> DLLStorageClass
pub fn set_dll_storage_class(self, dll_storage_class: DLLStorageClass)
pub fn get_initializer(self) -> Option<BasicValueEnum<'ctx>>
pub fn set_initializer(self, value: &dyn BasicValue<'ctx>)
pub fn is_thread_local(self) -> bool
pub fn set_thread_local(self, is_thread_local: bool)
pub fn get_thread_local_mode(self) -> Option<ThreadLocalMode>
pub fn set_thread_local_mode(self, thread_local_mode: Option<ThreadLocalMode>)
sourcepub fn is_declaration(self) -> bool
pub fn is_declaration(self) -> bool
Determines whether or not a GlobalValue
is a declaration or a definition.
Example
use inkwell::context::Context;
let context = Context::create();
let builder = context.create_builder();
let module = context.create_module("my_mod");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let fn_value = module.add_function("my_func", fn_type, None);
assert!(fn_value.as_global_value().is_declaration());
context.append_basic_block(fn_value, "entry");
assert!(!fn_value.as_global_value().is_declaration());
pub fn has_unnamed_addr(self) -> bool
pub fn set_unnamed_addr(self, has_unnamed_addr: bool)
pub fn is_constant(self) -> bool
pub fn set_constant(self, is_constant: bool)
pub fn is_externally_initialized(self) -> bool
pub fn set_externally_initialized(self, externally_initialized: bool)
pub fn set_visibility(self, visibility: GlobalVisibility)
pub fn get_visibility(self) -> GlobalVisibility
sourcepub fn get_section(&self) -> Option<&CStr>
pub fn get_section(&self) -> Option<&CStr>
Get section, this global value belongs to
sourcepub fn set_section(self, section: Option<&str>)
pub fn set_section(self, section: Option<&str>)
Set section, this global value belongs to
pub unsafe fn delete(self)
pub fn as_pointer_value(self) -> PointerValue<'ctx>
pub fn get_alignment(self) -> u32
pub fn set_alignment(self, alignment: u32)
sourcepub fn set_metadata(self, metadata: MetadataValue<'ctx>, kind_id: u32)
pub fn set_metadata(self, metadata: MetadataValue<'ctx>, kind_id: u32)
Sets a metadata of the given type on the GlobalValue
sourcepub fn get_comdat(self) -> Option<Comdat>
pub fn get_comdat(self) -> Option<Comdat>
Gets a Comdat
assigned to this GlobalValue
, if any.
sourcepub fn set_comdat(self, comdat: Comdat)
pub fn set_comdat(self, comdat: Comdat)
Assigns a Comdat
to this GlobalValue
.
pub fn get_unnamed_address(self) -> UnnamedAddress
pub fn set_unnamed_address(self, address: UnnamedAddress)
pub fn get_linkage(self) -> Linkage
pub fn set_linkage(self, linkage: Linkage)
Trait Implementations§
source§impl<'ctx> AnyValue<'ctx> for GlobalValue<'ctx>
impl<'ctx> AnyValue<'ctx> for GlobalValue<'ctx>
source§fn as_any_value_enum(&self) -> AnyValueEnum<'ctx>
fn as_any_value_enum(&self) -> AnyValueEnum<'ctx>
Returns an enum containing a typed version of
AnyValue
.source§fn print_to_string(&self) -> LLVMString
fn print_to_string(&self) -> LLVMString
Prints a value to a
LLVMString
source§impl AsValueRef for GlobalValue<'_>
impl AsValueRef for GlobalValue<'_>
fn as_value_ref(&self) -> LLVMValueRef
source§impl<'ctx> BasicValue<'ctx> for GlobalValue<'ctx>
impl<'ctx> BasicValue<'ctx> for GlobalValue<'ctx>
source§fn as_basic_value_enum(&self) -> BasicValueEnum<'ctx>
fn as_basic_value_enum(&self) -> BasicValueEnum<'ctx>
Returns an enum containing a typed version of the
BasicValue
.source§fn as_instruction_value(&self) -> Option<InstructionValue<'ctx>>
fn as_instruction_value(&self) -> Option<InstructionValue<'ctx>>
Most
BasicValue
s are the byproduct of an instruction
and so are convertible into an InstructionValue
fn get_first_use(&self) -> Option<BasicValueUse<'_>>
source§impl<'ctx> Clone for GlobalValue<'ctx>
impl<'ctx> Clone for GlobalValue<'ctx>
source§fn clone(&self) -> GlobalValue<'ctx>
fn clone(&self) -> GlobalValue<'ctx>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'ctx> Debug for GlobalValue<'ctx>
impl<'ctx> Debug for GlobalValue<'ctx>
source§impl Display for GlobalValue<'_>
impl Display for GlobalValue<'_>
source§impl<'ctx> Hash for GlobalValue<'ctx>
impl<'ctx> Hash for GlobalValue<'ctx>
source§impl<'ctx> PartialEq for GlobalValue<'ctx>
impl<'ctx> PartialEq for GlobalValue<'ctx>
source§fn eq(&self, other: &GlobalValue<'ctx>) -> bool
fn eq(&self, other: &GlobalValue<'ctx>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'ctx> Copy for GlobalValue<'ctx>
impl<'ctx> Eq for GlobalValue<'ctx>
impl<'ctx> StructuralEq for GlobalValue<'ctx>
impl<'ctx> StructuralPartialEq for GlobalValue<'ctx>
Auto Trait Implementations§
impl<'ctx> RefUnwindSafe for GlobalValue<'ctx>
impl<'ctx> !Send for GlobalValue<'ctx>
impl<'ctx> !Sync for GlobalValue<'ctx>
impl<'ctx> Unpin for GlobalValue<'ctx>
impl<'ctx> UnwindSafe for GlobalValue<'ctx>
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