Metadata
LLVM.Metadata — Type
MetadataAbstract supertype for all metadata types.
LLVM.MDString — Type
MDStringA string metadata node.
LLVM.MDString — Method
MDString(val::String)Create a new string metadata node from the given Julia string.
Base.convert — Method
convert(String, md::MDString)Get the string value of the given string metadata node.
LLVM.MDNode — Type
MDNodeAbstract supertype for metadata nodes that can have operands.
See also: MDTuple for a concrete subtype.
LLVM.operands — Method
operands(md::MDNode)Get the operands of the given metadata node.
LLVM.MDTuple — Type
MDTupleA tuple metadata node.
LLVM.MDNode — Method
MDNode(vals::Vector) -> MDTupleCreate a new tuple metadata node from the given operands.
Passing nothing as a value will result in a null operand.
Metadata <-> Value
LLVM.ValueAsMetadata — Type
LLVM.ValueAsMetadataAbstract type for values wrapped as metadata, for use in APIs that expect a LLVM.Metadata.
See also: Metadata(::Value) to convert back to a metadata.
LLVM.Metadata — Method
Metadata(val::Value)Wrap the given value as metadata, for use in APIs that expect a LLVM.Metadata.
When the value is already metadata wrapped as a value, this will simply return the original metadata.
LLVM.MetadataAsValue — Type
LLVM.MetadataAsValueMetadata wrapped as a regular value, for use in APIs that expect a LLVM.Value.
See also: Value(::Metadata) to convert back to a value.
LLVM.Value — Method
Value(md::Metadata)Wrap the given metadata as a value, for use in APIs that expect a LLVM.Value.
When the metadata is already a value wrapped as metadata, this will simply return the original value.
Inspecting and attaching
LLVM.metadata — Method
metadata(inst::Instruction)
metadata(inst::GlobalObject)Iterate over the metadata of the given instruction or global object.
These iterators are mutable, and implement setindex! and delete! to modify the metadata.
LLVM.NamedMDNode — Type
NamedMDNodeA named metadata node, which is a collection of metadata nodes with a name.
LLVM.metadata — Method
metadata(mod)Fetch the module-level named metadata. This can be inspected using a Dict-like interface. Mutation is different: There is no setindex! method, as named metadata is append-only. Instead, fetch the named metadata node using getindex, and push! to it.
LLVM.operands — Method
operands(node::NamedMDNode)Get the operands of the given named metadata node.
Base.push! — Method
push!(node::NamedMDNode, val::MDNode)Add a metadata node to the given named metadata node.
Debug information
LLVM.DINode — Type
DINodea tagged DWARF-like metadata node.
Builder
LLVM.DIBuilder — Type
DIBuilderA builder for constructing debug information metadata.
This object needs to be disposed of using dispose, which also finalizes the debug info. Call finalize! explicitly only if you need to use the finalized debug info (e.g. emit code) before disposing of the builder.
LLVM.DIBuilder — Method
DIBuilder(mod::Module; allow_unresolved::Bool=true)Create a new debug info builder that emits metadata into mod.
When allow_unresolved is true (the default), the builder collects unresolved metadata nodes attached to the module so that cycles can be resolved during dispose. When false, the builder errors on unresolved nodes instead.
LLVM.dispose — Method
dispose(builder::DIBuilder)Finalize the debug info and dispose of the builder. Finalization populates the compile unit's enum/retained-type/global/imported-entity/macro arrays, seals each subprogram's retained-nodes list, and resolves remaining cycles. If no compile unit was registered with the builder, or the debug info was already finalized through finalize!, finalization is skipped: DIBuilder::finalize is not idempotent (e.g., re-finalizing accesses already-deleted temporary macro files).
LLVM.finalize! — Method
finalize!(builder::DIBuilder)Resolve any unresolved metadata nodes and mark all compile units finalized. Called automatically by dispose; call explicitly only if the DI-enriched module must be consumed (e.g. for code emission) before the builder is disposed of. Skipped if no compile unit has been registered, or if the debug info has already been finalized.
LLVM.finalize_subprogram! — Function
finalize_subprogram!(builder::DIBuilder, sp::DISubProgram)Finalize a single subprogram early, sealing its retained-nodes list. After this, no more local variables can be added to sp. A no-op if sp was not tracked by builder (e.g. created elsewhere or already finalized).
Calling this is never required for correctness — dispose / finalize! finalize every tracked subprogram automatically. Use it only when streaming many subprograms through the builder and wanting to release their bookkeeping early.
Location information
LLVM.DILocation — Type
DILocationA location in the source code.
LLVM.column — Function
column(location::DILocation)Get the column number of this debug location.
LLVM.scope — Method
scope(location::DILocation)Get the local scope associated with this debug location.
LLVM.inlined_at — Function
inlined_at(location::DILocation)Get the "inline at" location associated with this debug location.
Variables
LLVM.DIVariable — Type
DIVariableAbstract supertype for all variable-like metadata nodes.
LLVM.DILocalVariable — Type
DILocalVariable <: DIVariableA local variable in the source code.
LLVM.DIGlobalVariable — Type
DIGlobalVariable <: DIVariableA global variable in the source code.
LLVM.scope — Method
scope(var::DIVariable)Get the scope of the given variable.
Scopes
LLVM.DIScope — Type
DIScopeAbstract supertype for lexical scopes and types (which are also declaration contexts).
File
LLVM.DIFile — Type
DIFileA file in the source code.
LLVM.directory — Function
directory(file::DIFile)Get the directory of a given file.
LLVM.filename — Function
filename(file::DIFile)Get the filename of the given file.
LLVM.source — Function
source(file::DIFile)Get the source of the given file, or nothing if the source is not available.
LLVM.file! — Function
file!(builder::DIBuilder, filename::AbstractString, directory::AbstractString) -> DIFileCreate a new DIFile describing the given source file.
Lexical Block
LLVM.DILexicalBlock — Type
DILexicalBlockA lexical block (a nested scope, typically a compound statement) in the source code.
LLVM.DILexicalBlockFile — Type
DILexicalBlockFileA lexical block that changes the current source file, e.g. due to an #include.
LLVM.lexical_block! — Function
lexical_block!(builder::DIBuilder, scope::DIScope, file::DIFile,
line::Integer, column::Integer) -> DILexicalBlockCreate a new DILexicalBlock describing a nested source scope.
LLVM.lexical_block_file! — Function
lexical_block_file!(builder::DIBuilder, scope::DIScope, file::DIFile,
discriminator::Integer=0) -> DILexicalBlockFileCreate a new DILexicalBlockFile for tracking source-file changes within a lexical scope.
Module
LLVM.DIModule — Type
DIModuleA module in the source code (Clang modules / Fortran modules / Swift modules).
LLVM.dimodule! — Function
dimodule!(builder::DIBuilder, parent_scope::DIScope, name::AbstractString;
config_macros::AbstractString="", include_path::AbstractString="",
api_notes_file::AbstractString="") -> DIModuleCreate a new DIModule describing a module in the source code.
Namespace
LLVM.DINamespace — Type
DINamespaceA namespace in the source code.
LLVM.namespace! — Function
namespace!(builder::DIBuilder, parent_scope::DIScope, name::AbstractString;
export_symbols::Bool=false) -> DINamespaceCreate a new DINamespace describing a namespace in the source code.
Type
LLVM.DIType — Type
DITypeAbstract supertype for all type-like metadata nodes.
LLVM.DIBasicType — Type
DIBasicType <: DITypeA primitive type (integer, floating-point, boolean, ...), built with basic_type!.
LLVM.DIDerivedType — Type
DIDerivedType <: DITypeA type derived from another type by adding qualifiers, reference/pointer indirection, a typedef name, or by describing a member/field. Built with pointer_type!, typedef_type!, member_type!, and the other qualifier/member factories.
LLVM.DICompositeType — Type
DICompositeType <: DITypeAn aggregate type (struct, union, class, array, vector, enumeration, ...). Built with struct_type!, union_type!, array_type!, etc.
LLVM.DISubroutineType — Type
DISubroutineType <: DITypeA function/subroutine type, listing the return and parameter types. Built with subroutine_type!.
Base.sizeof — Method
sizeof(typ::DIType)Get the size in bits of the given type.
LLVM.offset — Method
offset(typ::DIType)Get the offset in bits of the given type.
LLVM.flags — Method
flags(typ::DIType)Get the flags of the given type.
LLVM.align — Function
align(typ::DIType)Get the alignment in bits of the given type.
LLVM.DIEnumerator — Type
DIEnumeratorA single enumerator value in an enumeration type.
LLVM.DISubrange — Type
DISubrangeA subrange describing one dimension of an array or vector type.
Built-in factories for primitive types:
LLVM.basic_type! — Function
basic_type!(builder::DIBuilder, name::AbstractString, size_in_bits::Integer,
encoding::Integer; flags=API.LLVMDIFlagZero) -> DIBasicTypeCreate a new DIBasicType, such as an integer or floating-point type. encoding is a DW_ATE_* value (see the DWARF standard).
LLVM.unspecified_type! — Function
unspecified_type!(builder::DIBuilder, name::AbstractString) -> DIBasicTypeCreate a new unspecified type (DW_TAG_unspecified_type), e.g. a C++ decltype(nullptr).
LLVM.nullptr_type! — Function
nullptr_type!(builder::DIBuilder) -> DIBasicTypeCreate a new type representing a null pointer.
Derived types (pointers, qualifiers, members, inheritance, ...):
LLVM.pointer_type! — Function
pointer_type!(builder::DIBuilder, pointee_type::DIType, size_in_bits::Integer;
align_in_bits::Integer=0, address_space::Integer=0,
name::AbstractString="") -> DIDerivedTypeCreate a new pointer type.
LLVM.reference_type! — Function
reference_type!(builder::DIBuilder, tag::Integer, type::DIType) -> DIDerivedTypeCreate a new reference type (C++ T& / T&&), with the given DWARF tag (e.g. DW_TAG_reference_type or DW_TAG_rvalue_reference_type).
LLVM.lvalue_reference_type! — Function
lvalue_reference_type!(builder::DIBuilder, type::DIType) -> DIDerivedTypeCreate a C++ T& reference type. Shorthand for reference_type!(builder, DW_TAG_reference_type, type).
LLVM.rvalue_reference_type! — Function
rvalue_reference_type!(builder::DIBuilder, type::DIType) -> DIDerivedTypeCreate a C++ T&& rvalue-reference type. Shorthand for reference_type!(builder, DW_TAG_rvalue_reference_type, type).
LLVM.typedef_type! — Function
typedef_type!(builder::DIBuilder, type::DIType, name::AbstractString,
file::DIFile, line::Integer, scope::DIScope;
align_in_bits::Integer=0) -> DIDerivedTypeCreate a new typedef type.
LLVM.qualified_type! — Function
qualified_type!(builder::DIBuilder, tag::Integer, type::DIType) -> DIDerivedTypeCreate a new qualified type, such as const T (DW_TAG_const_type) or volatile T (DW_TAG_volatile_type). See also the named convenience wrappers const_type! and volatile_type!.
LLVM.const_type! — Function
const_type!(builder::DIBuilder, type::DIType) -> DIDerivedTypeCreate a const-qualified type. Shorthand for qualified_type!(builder, DW_TAG_const_type, type).
LLVM.volatile_type! — Function
volatile_type!(builder::DIBuilder, type::DIType) -> DIDerivedTypeCreate a volatile-qualified type. Shorthand for qualified_type!(builder, DW_TAG_volatile_type, type).
LLVM.artificial_type! — Function
artificial_type!(builder::DIBuilder, type::DIType) -> DITypeCreate a new artificial type (DI_FLAG_ARTIFICIAL), e.g. an implicit this. The concrete subtype matches the input (e.g. a DIBasicType stays a DIBasicType).
LLVM.object_pointer_type! — Function
object_pointer_type!(builder::DIBuilder, type::DIType;
implicit::Bool=true) -> DITypeCreate a new type identifying an object pointer (DI_FLAG_OBJECT_POINTER). The concrete subtype matches the input. On LLVM 20+ an implicit::Bool keyword is accepted: when true (the default, matching LLVM ≤ 19 behavior) the clone also sets DI_FLAG_ARTIFICIAL.
LLVM.member_type! — Function
member_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, size_in_bits::Integer,
align_in_bits::Integer, offset_in_bits::Integer,
type::DIType; flags=API.LLVMDIFlagZero) -> DIDerivedTypeCreate a new member (field) of a composite type.
LLVM.bitfield_member_type! — Function
bitfield_member_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, size_in_bits::Integer,
offset_in_bits::Integer, storage_offset_in_bits::Integer,
type::DIType; flags=API.LLVMDIFlagZero) -> DIDerivedTypeCreate a new bit-field member of a composite type.
LLVM.static_member_type! — Function
static_member_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, type::DIType,
constant_val::Constant;
flags=API.LLVMDIFlagZero,
align_in_bits::Integer=0) -> DIDerivedTypeCreate a new static member of a composite type. constant_val is required: the underlying C entry point unconditionally cast<Constant>s it and crashes on null.
LLVM.member_pointer_type! — Function
member_pointer_type!(builder::DIBuilder, pointee_type::DIType, class_type::DIType,
size_in_bits::Integer;
align_in_bits::Integer=0,
flags=API.LLVMDIFlagZero) -> DIDerivedTypeCreate a new pointer-to-member type for C++.
LLVM.inheritance! — Function
inheritance!(builder::DIBuilder, derived::DIType, base::DIType,
base_offset::Integer, vbptr_offset::Integer=0;
flags=API.LLVMDIFlagZero) -> DIDerivedTypeCreate a new inheritance relationship from derived to base.
Composite types:
LLVM.struct_type! — Function
struct_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, size_in_bits::Integer,
align_in_bits::Integer, elements::Vector{<:Metadata};
flags=API.LLVMDIFlagZero, derived_from=nothing,
runtime_lang::Integer=0, vtable_holder=nothing,
unique_id::AbstractString="") -> DICompositeTypeCreate a new struct type.
LLVM.union_type! — Function
union_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, size_in_bits::Integer,
align_in_bits::Integer, elements::Vector{<:Metadata};
flags=API.LLVMDIFlagZero, runtime_lang::Integer=0,
unique_id::AbstractString="") -> DICompositeTypeCreate a new union type.
LLVM.class_type! — Function
class_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, size_in_bits::Integer,
align_in_bits::Integer, offset_in_bits::Integer,
elements::Vector{<:Metadata};
flags=API.LLVMDIFlagZero, derived_from=nothing,
vtable_holder=nothing, template_params=nothing,
unique_id::AbstractString="") -> DICompositeTypeCreate a new C++ class type.
LLVM.array_type! — Function
array_type!(builder::DIBuilder, size::Integer, align_in_bits::Integer,
element_type::DIType, subscripts::Vector{<:Metadata}) -> DICompositeTypeCreate a new array type. Subscripts are typically built with get_or_create_subrange!.
LLVM.vector_type! — Function
vector_type!(builder::DIBuilder, size::Integer, align_in_bits::Integer,
element_type::DIType, subscripts::Vector{<:Metadata}) -> DICompositeTypeCreate a new vector type. Subscripts are typically built with get_or_create_subrange!.
LLVM.enumerator! — Function
enumerator!(builder::DIBuilder, name::AbstractString, value::Integer;
unsigned::Bool=false) -> DIEnumeratorCreate a new enumerator for use inside an enumeration type.
LLVM.enumeration_type! — Function
enumeration_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, size_in_bits::Integer,
align_in_bits::Integer, elements::Vector{<:Metadata};
class_ty=nothing) -> DICompositeTypeCreate a new enumeration type. elements should be a vector of DIEnumerator metadata nodes.
LLVM.forward_decl! — Function
forward_decl!(builder::DIBuilder, tag::Integer, name::AbstractString,
scope::DIScope, file::DIFile, line::Integer;
runtime_lang::Integer=0, size_in_bits::Integer=0,
align_in_bits::Integer=0,
unique_id::AbstractString="") -> DICompositeTypeCreate a new forward declaration to a composite type.
LLVM.replaceable_composite_type! — Function
replaceable_composite_type!(builder::DIBuilder, tag::Integer,
name::AbstractString, scope::DIScope,
file::DIFile, line::Integer;
runtime_lang::Integer=0, size_in_bits::Integer=0,
align_in_bits::Integer=0,
flags=API.LLVMDIFlagZero,
unique_id::AbstractString="") -> DICompositeTypeCreate a new replaceable composite type forward declaration.
LLVM.get_or_create_subrange! — Function
get_or_create_subrange!(builder::DIBuilder, lower_bound::Integer, count::Integer)Get or create a subrange metadata node, describing one dimension of an array or vector type.
Subroutine types:
LLVM.subroutine_type! — Function
subroutine_type!(builder::DIBuilder, file::DIFile,
return_type::Union{DIType,Nothing},
parameter_types::Vector{<:Metadata}=Metadata[];
flags=API.LLVMDIFlagZero) -> DISubroutineTypeCreate a new subroutine type with the given return and parameter types. Pass nothing for return_type to describe a void-returning subroutine.
Array-node helpers:
LLVM.get_or_create_array! — Function
get_or_create_array!(builder::DIBuilder, elements::Vector{<:Metadata})Get or create a generic metadata array node, used for lists such as elements fields of composite types.
LLVM.get_or_create_type_array! — Function
get_or_create_type_array!(builder::DIBuilder, types::Vector{<:Metadata})Get or create a metadata node for a type array, used for e.g. template parameter lists.
Objective-C:
LLVM.DIObjCProperty — Type
DIObjCPropertyAn Objective-C @property descriptor.
LLVM.objc_ivar! — Function
objc_ivar!(builder::DIBuilder, name::AbstractString, file::DIFile,
line::Integer, size_in_bits::Integer, align_in_bits::Integer,
offset_in_bits::Integer, type::DIType, property_node::Metadata;
flags=API.LLVMDIFlagZero) -> DIDerivedTypeCreate a new Objective-C instance variable.
LLVM.objc_property! — Function
objc_property!(builder::DIBuilder, name::AbstractString, file::DIFile,
line::Integer, getter::AbstractString, setter::AbstractString,
attributes::Integer, type::DIType) -> DIObjCPropertyCreate a new Objective-C @property descriptor.
Subprogram
LLVM.DISubProgram — Type
DISubProgramA subprogram in the source code.
LLVM.subprogram! — Method
subprogram!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, type::DISubroutineType;
linkage_name::AbstractString="", scope_line::Integer=line,
is_local_to_unit::Bool=false, is_definition::Bool=true,
flags=API.LLVMDIFlagZero,
is_optimized::Bool=false) -> DISubProgramCreate a new DISubProgram describing a function. When linkage_name is empty, LLVM falls back to name. scope_line defaults to the function's line, which is the usual case.
Variables
Factories for local variables and parameters:
LLVM.auto_variable! — Function
auto_variable!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, type::DIType;
always_preserve::Bool=false, flags=API.LLVMDIFlagZero,
align_in_bits::Integer=0) -> DILocalVariableCreate a new local variable descriptor (for a compiler-introduced automatic variable).
LLVM.parameter_variable! — Function
parameter_variable!(builder::DIBuilder, scope::DIScope, name::AbstractString,
arg_no::Integer, file::DIFile, line::Integer, type::DIType;
always_preserve::Bool=false,
flags=API.LLVMDIFlagZero) -> DILocalVariableCreate a new descriptor for a function parameter variable. arg_no is the 1-based parameter index.
Expressions
LLVM.DIExpression — Type
DIExpressionA DWARF expression that modifies how a variable's value is expressed at runtime.
LLVM.DIGlobalVariableExpression — Type
DIGlobalVariableExpressionA pairing of a DIGlobalVariable and its associated DIExpression.
LLVM.expression! — Function
expression!(builder::DIBuilder,
addr::Vector{UInt64}=UInt64[]) -> DIExpressionCreate a new DIExpression from the given array of opcodes (encoding a DWARF expression such as DW_OP_plus_uconst).
LLVM.constant_value_expression! — Function
constant_value_expression!(builder::DIBuilder, value::Integer) -> DIExpressionCreate a new DIExpression representing a single constant value.
LLVM.variable — Function
variable(gve::DIGlobalVariableExpression)Get the debug info global variable associated with the given expression.
LLVM.expression — Function
expression(gve::DIGlobalVariableExpression)Get the debug info expression associated with the given global-variable pair.
LLVM.global_variable_expression! — Function
global_variable_expression!(builder::DIBuilder, scope::DIScope,
name::AbstractString, linkage::AbstractString,
file::DIFile, line::Integer, type::DIType,
local_to_unit::Bool, expression::DIExpression;
declaration=nothing,
align_in_bits::Integer=0) -> DIGlobalVariableExpressionCreate a new global variable descriptor paired with a DWARF expression.
LLVM.temp_global_variable_fwd_decl! — Function
temp_global_variable_fwd_decl!(builder::DIBuilder, scope::DIScope,
name::AbstractString, linkage::AbstractString,
file::DIFile, line::Integer, type::DIType,
local_to_unit::Bool;
declaration=nothing,
align_in_bits::Integer=0) -> DIGlobalVariableCreate a new temporary forward declaration for a global variable.
Imported entities
LLVM.DIImportedEntity — Type
DIImportedEntityAn imported entity, such as a C++ using declaration or module import.
LLVM.imported_module_from_namespace! — Function
imported_module_from_namespace!(builder::DIBuilder, scope::DIScope,
ns::DINamespace, file::DIFile,
line::Integer) -> DIImportedEntityCreate a new DIImportedEntity from a namespace.
LLVM.imported_module_from_alias! — Function
imported_module_from_alias!(builder::DIBuilder, scope::DIScope,
imported::DIImportedEntity, file::DIFile,
line::Integer,
elements::Vector{<:Metadata}=Metadata[]) -> DIImportedEntityCreate a new DIImportedEntity from an alias.
LLVM.imported_module_from_module! — Function
imported_module_from_module!(builder::DIBuilder, scope::DIScope,
mod::DIModule, file::DIFile, line::Integer,
elements::Vector{<:Metadata}=Metadata[]) -> DIImportedEntityCreate a new DIImportedEntity from a module.
LLVM.imported_declaration! — Function
imported_declaration!(builder::DIBuilder, scope::DIScope, decl::Metadata,
file::DIFile, line::Integer, name::AbstractString,
elements::Vector{<:Metadata}=Metadata[]) -> DIImportedEntityCreate a new DIImportedEntity from a declaration.
Macros
LLVM.DIMacro — Type
DIMacroA single preprocessor macro definition or undefinition.
LLVM.DIMacroFile — Type
DIMacroFileA collection of macro records corresponding to a single source file.
LLVM.macro! — Function
macro!(builder::DIBuilder, parent_macrofile::Union{DIMacroFile,Nothing},
line::Integer, record_type, name::AbstractString,
value::AbstractString) -> DIMacroCreate a new DIMacro. record_type is a LLVMDWARFMacinfoRecordType value (e.g. LLVM.API.LLVMDWARFMacinfoRecordTypeDefine).
LLVM.temp_macro_file! — Function
temp_macro_file!(builder::DIBuilder,
parent_macrofile::Union{DIMacroFile,Nothing},
line::Integer, file::DIFile) -> DIMacroFileCreate a new (temporary) DIMacroFile.
Instruction-level insertion
The declare_*! / value_*! methods return an Instruction on LLVM ≤ 18 (legacy llvm.dbg.* intrinsics) and a LLVM.DbgRecord on LLVM ≥ 19 (the new #dbg_* record format).
LLVM.declare_before! — Function
declare_before!(builder::DIBuilder, storage::Value, var::DILocalVariable,
expr::DIExpression, debugloc::DILocation,
instr::Instruction)Insert a new dbg-declare describing storage as the runtime location of var, immediately before instr. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.declare call Instruction on LLVM < 19.
LLVM.declare_at_end! — Function
declare_at_end!(builder::DIBuilder, storage::Value, var::DILocalVariable,
expr::DIExpression, debugloc::DILocation,
block::BasicBlock)Insert a new dbg-declare at the end of block. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.declare call Instruction on LLVM < 19.
LLVM.value_before! — Function
value_before!(builder::DIBuilder, val::Value, var::DILocalVariable,
expr::DIExpression, debugloc::DILocation,
instr::Instruction)Insert a new dbg-value describing val as the value of var, immediately before instr. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.value call Instruction on LLVM < 19.
LLVM.value_at_end! — Function
value_at_end!(builder::DIBuilder, val::Value, var::DILocalVariable,
expr::DIExpression, debugloc::DILocation,
block::BasicBlock)Insert a new dbg-value at the end of block. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.value call Instruction on LLVM < 19.
LLVM.debuglocation — Method
debuglocation(inst::Instruction) -> Union{DILocation,Nothing}Get the debug location attached to the given instruction, or nothing.
LLVM.debuglocation! — Method
debuglocation!(inst::Instruction, loc::DILocation)Set the debug location of the given instruction.
LLVM.debuglocation! — Method
debuglocation!(inst::Instruction)Clear the debug location of the given instruction.
Compile Unit
LLVM.DICompileUnit — Type
DICompileUnitA compilation unit in the source code.
LLVM.compile_unit! — Function
compile_unit!(builder::DIBuilder, lang, file::DIFile, producer::AbstractString;
optimized::Bool=true, cmdline::AbstractString="",
runtime_version::Integer=0,
split_name::Union{AbstractString,Nothing}=nothing,
emission_kind=API.LLVMDWARFEmissionFull,
dwo_id::Integer=0,
split_debug_inlining::Bool=true,
debug_info_for_profiling::Bool=false,
sysroot::AbstractString="", sdk::AbstractString="") -> DICompileUnitCreate a new DICompileUnit. lang is a LLVMDWARFSourceLanguage value (e.g. LLVM.API.LLVMDWARFSourceLanguageJulia). cmdline is a command-line string embedded verbatim in the emitted debug info.
Mutation helpers
LLVM.temporary_mdnode — Function
temporary_mdnode(operands::Vector{<:Metadata}=Metadata[]) -> MDNodeCreate a temporary metadata node in the task-local context with the given operands. Temporary nodes are useful for constructing cycles and must be either replaced via replace_uses! or disposed of via dispose_temporary.
LLVM.dispose_temporary — Function
dispose_temporary(md::Metadata)Dispose of a temporary metadata node returned by temporary_mdnode.
LLVM.replace_uses! — Method
replace_uses!(temp::Metadata, replacement::Metadata)Replace all uses of temporary metadata temp with replacement, and dispose of temp. Method on the existing replace_uses! for Value.
Other
LLVM.DEBUG_METADATA_VERSION — Function
DEBUG_METADATA_VERSION()The current debug info version number, as supported by LLVM.
LLVM.debug_metadata_version — Function
debug_metadata_version(mod::Module)Get the debug info version number emitted in the given module, or 0 if none is attached.
LLVM.strip_debuginfo! — Function
strip_debuginfo!(mod::Module)Strip the debug information from the given module.
LLVM.subprogram — Method
subprogram(func::Function) -> DISubProgramGet the subprogram of the given function, or nothing if the function has no subprogram.
LLVM.subprogram! — Function
subprogram!(builder::DIBuilder, scope::DIScope, name::AbstractString,
file::DIFile, line::Integer, type::DISubroutineType;
linkage_name::AbstractString="", scope_line::Integer=line,
is_local_to_unit::Bool=false, is_definition::Bool=true,
flags=API.LLVMDIFlagZero,
is_optimized::Bool=false) -> DISubProgramCreate a new DISubProgram describing a function. When linkage_name is empty, LLVM falls back to name. scope_line defaults to the function's line, which is the usual case.
subprogram!(func::Function, sp::DISubProgram)Set the subprogram of the given function.