Struct inkwell::values::FunctionValue[][src]

pub struct FunctionValue<'ctx> { /* fields omitted */ }

Implementations

Gets the name of a FunctionValue.

View the control flow graph and produce a .dot file

Only view the control flow graph

This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.
This is supported on crate features llvm3-7 or llvm3-8 or llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.
This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Adds an Attribute to a particular location in this FunctionValue.

Example

use inkwell::attributes::AttributeLoc;
use inkwell::context::Context;

let context = Context::create();
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_fn", fn_type, None);
let string_attribute = context.create_string_attribute("my_key", "my_val");
let enum_attribute = context.create_enum_attribute(1, 1);

fn_value.add_attribute(AttributeLoc::Return, string_attribute);
fn_value.add_attribute(AttributeLoc::Return, enum_attribute);
This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Counts the number of Attributes belonging to the specified location in this FunctionValue.

Example

use inkwell::attributes::AttributeLoc;
use inkwell::context::Context;

let context = Context::create();
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_fn", fn_type, None);
let string_attribute = context.create_string_attribute("my_key", "my_val");
let enum_attribute = context.create_enum_attribute(1, 1);

fn_value.add_attribute(AttributeLoc::Return, string_attribute);
fn_value.add_attribute(AttributeLoc::Return, enum_attribute);

assert_eq!(fn_value.count_attributes(AttributeLoc::Return), 2);
This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Removes a string Attribute belonging to the specified location in this FunctionValue.

Example

use inkwell::attributes::AttributeLoc;
use inkwell::context::Context;

let context = Context::create();
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_fn", fn_type, None);
let string_attribute = context.create_string_attribute("my_key", "my_val");

fn_value.add_attribute(AttributeLoc::Return, string_attribute);
fn_value.remove_string_attribute(AttributeLoc::Return, "my_key");
This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Removes an enum Attribute belonging to the specified location in this FunctionValue.

Example

use inkwell::attributes::AttributeLoc;
use inkwell::context::Context;

let context = Context::create();
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_fn", fn_type, None);
let enum_attribute = context.create_enum_attribute(1, 1);

fn_value.add_attribute(AttributeLoc::Return, enum_attribute);
fn_value.remove_enum_attribute(AttributeLoc::Return, 1);
This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Gets an enum Attribute belonging to the specified location in this FunctionValue.

Example

use inkwell::attributes::AttributeLoc;
use inkwell::context::Context;

let context = Context::create();
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_fn", fn_type, None);
let enum_attribute = context.create_enum_attribute(1, 1);

fn_value.add_attribute(AttributeLoc::Return, enum_attribute);

assert_eq!(fn_value.get_enum_attribute(AttributeLoc::Return, 1), Some(enum_attribute));
This is supported on crate features llvm3-9 or llvm4-0 or llvm5-0 or llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Gets a string Attribute belonging to the specified location in this FunctionValue.

Example

use inkwell::attributes::AttributeLoc;
use inkwell::context::Context;

let context = Context::create();
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_fn", fn_type, None);
let string_attribute = context.create_string_attribute("my_key", "my_val");

fn_value.add_attribute(AttributeLoc::Return, string_attribute);

assert_eq!(fn_value.get_string_attribute(AttributeLoc::Return, "my_key"), Some(string_attribute));

Gets the GlobalValue version of this FunctionValue. This allows you to further inspect its global properties or even convert it to a PointerValue.

This is supported on crate features llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Set the debug info descriptor

This is supported on crate features llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 only.

Get the debug info descriptor

Trait Implementations

Returns an enum containing a typed version of AnyValue.

Prints a value to a LLVMString

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.