Function get_poison

Source
pub fn get_poison(ty: &TypeRef) -> ValueRef
Expand description

Obtain a constant value referring to a poison value of a type.

§Details

Creates a ‘poison’ value of the specified type.

This function wraps the LLVMGetPoison function from the LLVM core library. It generates a constant ‘poison’ value for the specified type (ty). A poison value is similar to an undefined value but more strict; it is used to represent a value that results from an operation with undefined behavior. Using a poison value in further operations can propagate the poison, potentially leading to further undefined behavior.

§Parameters

  • ty: A reference to the type (TypeRef) for which the poison value should be created. This type determines the nature of the poison value (e.g., integer, floating-point, vector).

§Returns

Returns an instance of ValueRef, which encapsulates the constant poison value for the specified type.