Function set_value_name

Source
pub fn set_value_name(val: &ValueRef, name: &str)
Expand description

Set the string name of a value.

§Details

Sets the name of the LLVM value.

This function wraps the LLVMSetValueName2 function from the LLVM core library. It assigns a new name to the value represented by ValueRef. Naming a value in LLVM IR is useful for debugging, readability, and when generating human-readable IR. Named values typically include functions, global variables, and named instructions.

§Parameters

  • name: A string slice (&str) representing the new name to assign to the value.

§Example

let my_value: ValueRef; // Assume this is an LLVM value.
my_value.set_value_name("my_value_name");

After calling this function, the value will be named “my_value_name” in the LLVM IR.