pub struct DebugInfoBuilder<'ctx> { /* private fields */ }Expand description
A builder object to create debug info metadata. Used along with Builder while producing
IR. Created by Module::create_debug_info_builder. See debug_info module level
documentation for more.
Implementations§
Source§impl<'ctx> DebugInfoBuilder<'ctx>
impl<'ctx> DebugInfoBuilder<'ctx>
Sourcepub fn as_mut_ptr(&self) -> LLVMDIBuilderRef
pub fn as_mut_ptr(&self) -> LLVMDIBuilderRef
Acquires the underlying raw pointer belonging to this DebugInfoBuilder type.
Sourcepub fn create_function(
&self,
scope: DIScope<'ctx>,
name: &str,
linkage_name: Option<&str>,
file: DIFile<'ctx>,
line_no: u32,
ditype: DISubroutineType<'ctx>,
is_local_to_unit: bool,
is_definition: bool,
scope_line: u32,
flags: DIFlags,
is_optimized: bool,
) -> DISubprogram<'ctx>
pub fn create_function( &self, scope: DIScope<'ctx>, name: &str, linkage_name: Option<&str>, file: DIFile<'ctx>, line_no: u32, ditype: DISubroutineType<'ctx>, is_local_to_unit: bool, is_definition: bool, scope_line: u32, flags: DIFlags, is_optimized: bool, ) -> DISubprogram<'ctx>
A DIFunction provides an anchor for all debugging information generated for the specified subprogram.
scope- Function scope.name- Function name.linkage_name- Mangled function name, if any.file- File where this variable is defined.line_no- Line number.ty- Function type.is_local_to_unit- True if this function is not externally visible.is_definition- True if this is a function definition (“When isDefinition: false, subprograms describe a declaration in the type tree as opposed to a definition of a function”).scope_line- Set to the beginning of the scope this startsflags- E.g.: LLVMDIFlagLValueReference. These flags are used to emit dwarf attributes.is_optimized- True if optimization is ON.
Sourcepub fn create_lexical_block(
&self,
parent_scope: DIScope<'ctx>,
file: DIFile<'ctx>,
line: u32,
column: u32,
) -> DILexicalBlock<'ctx>
pub fn create_lexical_block( &self, parent_scope: DIScope<'ctx>, file: DIFile<'ctx>, line: u32, column: u32, ) -> DILexicalBlock<'ctx>
Create a lexical block scope.
Sourcepub fn create_file(&self, filename: &str, directory: &str) -> DIFile<'ctx>
pub fn create_file(&self, filename: &str, directory: &str) -> DIFile<'ctx>
Create a file scope.
Sourcepub fn create_debug_location(
&self,
context: impl AsContextRef<'ctx>,
line: u32,
column: u32,
scope: DIScope<'ctx>,
inlined_at: Option<DILocation<'ctx>>,
) -> DILocation<'ctx>
pub fn create_debug_location( &self, context: impl AsContextRef<'ctx>, line: u32, column: u32, scope: DIScope<'ctx>, inlined_at: Option<DILocation<'ctx>>, ) -> DILocation<'ctx>
Create a debug location.
Sourcepub fn create_basic_type(
&self,
name: &str,
size_in_bits: u64,
encoding: LLVMDWARFTypeEncoding,
flags: DIFlags,
) -> Result<DIBasicType<'ctx>, Error>
pub fn create_basic_type( &self, name: &str, size_in_bits: u64, encoding: LLVMDWARFTypeEncoding, flags: DIFlags, ) -> Result<DIBasicType<'ctx>, Error>
Create a primitive basic type. encoding is an unsigned int flag (DW_ATE_*
enum) defined by the chosen DWARF standard.
Sourcepub fn create_typedef(
&self,
ditype: DIType<'ctx>,
name: &str,
file: DIFile<'ctx>,
line_no: u32,
scope: DIScope<'ctx>,
align_in_bits: u32,
) -> DIDerivedType<'ctx>
pub fn create_typedef( &self, ditype: DIType<'ctx>, name: &str, file: DIFile<'ctx>, line_no: u32, scope: DIScope<'ctx>, align_in_bits: u32, ) -> DIDerivedType<'ctx>
Create a typedef (alias) of ditype
Sourcepub fn create_union_type(
&self,
scope: DIScope<'ctx>,
name: &str,
file: DIFile<'ctx>,
line_no: u32,
size_in_bits: u64,
align_in_bits: u32,
flags: DIFlags,
elements: &[DIType<'ctx>],
runtime_language: u32,
unique_id: &str,
) -> DICompositeType<'ctx>
pub fn create_union_type( &self, scope: DIScope<'ctx>, name: &str, file: DIFile<'ctx>, line_no: u32, size_in_bits: u64, align_in_bits: u32, flags: DIFlags, elements: &[DIType<'ctx>], runtime_language: u32, unique_id: &str, ) -> DICompositeType<'ctx>
Create union type of multiple types.
Sourcepub fn create_member_type(
&self,
scope: DIScope<'ctx>,
name: &str,
file: DIFile<'ctx>,
line_no: c_uint,
size_in_bits: u64,
align_in_bits: u32,
offset_in_bits: u64,
flags: DIFlags,
ty: DIType<'ctx>,
) -> DIDerivedType<'ctx>
pub fn create_member_type( &self, scope: DIScope<'ctx>, name: &str, file: DIFile<'ctx>, line_no: c_uint, size_in_bits: u64, align_in_bits: u32, offset_in_bits: u64, flags: DIFlags, ty: DIType<'ctx>, ) -> DIDerivedType<'ctx>
Create a type for a non-static member.
Sourcepub fn create_struct_type(
&self,
scope: DIScope<'ctx>,
name: &str,
file: DIFile<'ctx>,
line_no: c_uint,
size_in_bits: u64,
align_in_bits: u32,
flags: DIFlags,
derived_from: Option<DIType<'ctx>>,
elements: &[DIType<'ctx>],
runtime_language: c_uint,
vtable_holder: Option<DIType<'ctx>>,
unique_id: &str,
) -> DICompositeType<'ctx>
pub fn create_struct_type( &self, scope: DIScope<'ctx>, name: &str, file: DIFile<'ctx>, line_no: c_uint, size_in_bits: u64, align_in_bits: u32, flags: DIFlags, derived_from: Option<DIType<'ctx>>, elements: &[DIType<'ctx>], runtime_language: c_uint, vtable_holder: Option<DIType<'ctx>>, unique_id: &str, ) -> DICompositeType<'ctx>
Create a struct type.
Sourcepub fn create_subroutine_type(
&self,
file: DIFile<'ctx>,
return_type: Option<DIType<'ctx>>,
parameter_types: &[DIType<'ctx>],
flags: DIFlags,
) -> DISubroutineType<'ctx>
pub fn create_subroutine_type( &self, file: DIFile<'ctx>, return_type: Option<DIType<'ctx>>, parameter_types: &[DIType<'ctx>], flags: DIFlags, ) -> DISubroutineType<'ctx>
Create a function type
Sourcepub fn create_pointer_type(
&self,
name: &str,
pointee: DIType<'ctx>,
size_in_bits: u64,
align_in_bits: u32,
address_space: AddressSpace,
) -> DIDerivedType<'ctx>
pub fn create_pointer_type( &self, name: &str, pointee: DIType<'ctx>, size_in_bits: u64, align_in_bits: u32, address_space: AddressSpace, ) -> DIDerivedType<'ctx>
Creates a pointer type
Sourcepub fn create_reference_type(
&self,
pointee: DIType<'ctx>,
tag: u32,
) -> DIDerivedType<'ctx>
pub fn create_reference_type( &self, pointee: DIType<'ctx>, tag: u32, ) -> DIDerivedType<'ctx>
Creates a pointer type
Sourcepub fn create_array_type(
&self,
inner_type: DIType<'ctx>,
size_in_bits: u64,
align_in_bits: u32,
subscripts: &[Range<i64>],
) -> DICompositeType<'ctx>
pub fn create_array_type( &self, inner_type: DIType<'ctx>, size_in_bits: u64, align_in_bits: u32, subscripts: &[Range<i64>], ) -> DICompositeType<'ctx>
Creates an array type
Sourcepub fn create_enumeration_type(
&self,
scope: DIScope<'ctx>,
name: &str,
file: DIFile<'ctx>,
line_no: u32,
size_in_bits: u64,
align_in_bits: u32,
elements: &[DIEnumerator<'ctx>],
inner_type: DIType<'ctx>,
) -> DICompositeType<'ctx>
pub fn create_enumeration_type( &self, scope: DIScope<'ctx>, name: &str, file: DIFile<'ctx>, line_no: u32, size_in_bits: u64, align_in_bits: u32, elements: &[DIEnumerator<'ctx>], inner_type: DIType<'ctx>, ) -> DICompositeType<'ctx>
Create an enumeration type
Sourcepub fn create_enumerator(
&self,
name: &str,
value: i64,
is_unsigned: bool,
) -> DIEnumerator<'ctx>
pub fn create_enumerator( &self, name: &str, value: i64, is_unsigned: bool, ) -> DIEnumerator<'ctx>
Create an enumerator
pub fn create_global_variable_expression( &self, scope: DIScope<'ctx>, name: &str, linkage: &str, file: DIFile<'ctx>, line_no: u32, ty: DIType<'ctx>, local_to_unit: bool, expression: Option<DIExpression<'_>>, declaration: Option<DIScope<'_>>, align_in_bits: u32, ) -> DIGlobalVariableExpression<'ctx>
pub fn create_constant_expression(&self, value: i64) -> DIExpression<'ctx>
Sourcepub fn create_parameter_variable(
&self,
scope: DIScope<'ctx>,
name: &str,
arg_no: u32,
file: DIFile<'ctx>,
line_no: u32,
ty: DIType<'ctx>,
always_preserve: bool,
flags: DIFlags,
) -> DILocalVariable<'ctx>
pub fn create_parameter_variable( &self, scope: DIScope<'ctx>, name: &str, arg_no: u32, file: DIFile<'ctx>, line_no: u32, ty: DIType<'ctx>, always_preserve: bool, flags: DIFlags, ) -> DILocalVariable<'ctx>
Create function parameter variable.
Sourcepub fn create_auto_variable(
&self,
scope: DIScope<'ctx>,
name: &str,
file: DIFile<'ctx>,
line_no: u32,
ty: DIType<'ctx>,
always_preserve: bool,
flags: DIFlags,
align_in_bits: u32,
) -> DILocalVariable<'ctx>
pub fn create_auto_variable( &self, scope: DIScope<'ctx>, name: &str, file: DIFile<'ctx>, line_no: u32, ty: DIType<'ctx>, always_preserve: bool, flags: DIFlags, align_in_bits: u32, ) -> DILocalVariable<'ctx>
Create local automatic storage variable.
pub fn create_namespace( &self, scope: DIScope<'ctx>, name: &str, export_symbols: bool, ) -> DINamespace<'ctx>
Sourcepub fn insert_declare_before_instruction(
&self,
storage: PointerValue<'ctx>,
var_info: Option<DILocalVariable<'ctx>>,
expr: Option<DIExpression<'ctx>>,
debug_loc: DILocation<'ctx>,
instruction: InstructionValue<'ctx>,
) -> InstructionValue<'ctx>
pub fn insert_declare_before_instruction( &self, storage: PointerValue<'ctx>, var_info: Option<DILocalVariable<'ctx>>, expr: Option<DIExpression<'ctx>>, debug_loc: DILocation<'ctx>, instruction: InstructionValue<'ctx>, ) -> InstructionValue<'ctx>
Insert a variable declaration (llvm.dbg.declare) before a specified instruction.
Sourcepub fn insert_declare_at_end(
&self,
storage: PointerValue<'ctx>,
var_info: Option<DILocalVariable<'ctx>>,
expr: Option<DIExpression<'ctx>>,
debug_loc: DILocation<'ctx>,
block: BasicBlock<'ctx>,
) -> InstructionValue<'ctx>
pub fn insert_declare_at_end( &self, storage: PointerValue<'ctx>, var_info: Option<DILocalVariable<'ctx>>, expr: Option<DIExpression<'ctx>>, debug_loc: DILocation<'ctx>, block: BasicBlock<'ctx>, ) -> InstructionValue<'ctx>
Insert a variable declaration (llvm.dbg.declare intrinsic) at the end of block
Sourcepub fn create_expression(
&self,
address_operations: Vec<i64>,
) -> DIExpression<'ctx>
pub fn create_expression( &self, address_operations: Vec<i64>, ) -> DIExpression<'ctx>
Create an expression
Sourcepub fn insert_dbg_value_before(
&self,
value: BasicValueEnum<'ctx>,
var_info: DILocalVariable<'ctx>,
expr: Option<DIExpression<'ctx>>,
debug_loc: DILocation<'ctx>,
instruction: InstructionValue<'ctx>,
) -> InstructionValue<'ctx>
pub fn insert_dbg_value_before( &self, value: BasicValueEnum<'ctx>, var_info: DILocalVariable<'ctx>, expr: Option<DIExpression<'ctx>>, debug_loc: DILocation<'ctx>, instruction: InstructionValue<'ctx>, ) -> InstructionValue<'ctx>
Insert a new llvm.dbg.value intrinsic call before an instruction.
Sourcepub unsafe fn create_placeholder_derived_type(
&self,
context: impl AsContextRef<'ctx>,
) -> DIDerivedType<'ctx>
pub unsafe fn create_placeholder_derived_type( &self, context: impl AsContextRef<'ctx>, ) -> DIDerivedType<'ctx>
Construct a placeholders derived type to be used when building debug info with circular references.
All placeholders must be replaced before calling finalize().
Sourcepub unsafe fn replace_placeholder_derived_type(
&self,
placeholder: DIDerivedType<'ctx>,
other: DIDerivedType<'ctx>,
)
pub unsafe fn replace_placeholder_derived_type( &self, placeholder: DIDerivedType<'ctx>, other: DIDerivedType<'ctx>, )
Deletes a placeholder, replacing all uses of it with another derived type.
§Safety:
This and any other copies of this placeholder made by Copy or Clone become dangling pointers after calling this method.