pub fn const_null(ty: &TypeRef) -> ValueRef
Expand description
Obtain a constant value referring to the null instance of a type.
§Details
Creates a constant ‘null’ value of the specified type.
This function wraps the LLVMConstNull
function from the LLVM core library. It generates a constant
‘null’ value for the specified type (ty
). This is typically used for pointer types, where the null value
represents a pointer to no valid memory location, but it can also be used for other types where a zero-initialized
constant is required.
§Parameters
ty
: A reference to the type (TypeRef
) for which the null value should be created. This type determines the kind of null value that is generated (e.g., null pointer, zero-initialized struct).
§Returns
Returns an instance of ValueRef
, which encapsulates the constant null value for the specified type.