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>

source

pub fn as_mut_ptr(&self) -> LLVMDIBuilderRef

Acquires the underlying raw pointer belonging to this DebugInfoBuilder type.

source

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 starts
  • flags - E.g.: LLVMDIFlagLValueReference. These flags are used to emit dwarf attributes.
  • is_optimized - True if optimization is ON.
source

pub fn create_lexical_block( &self, parent_scope: DIScope<'ctx>, file: DIFile<'ctx>, line: u32, column: u32 ) -> DILexicalBlock<'ctx>

Create a lexical block scope.

source

pub fn create_file(&self, filename: &str, directory: &str) -> DIFile<'ctx>

Create a file scope.

source

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.

source

pub fn create_basic_type( &self, name: &str, size_in_bits: u64, encoding: LLVMDWARFTypeEncoding, flags: DIFlags ) -> Result<DIBasicType<'ctx>, &'static str>

Create a primitive basic type. encoding is an unsigned int flag (DW_ATE_* enum) defined by the chosen DWARF standard.

source

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

source

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.

source

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.

source

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.

source

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

source

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

source

pub fn create_reference_type( &self, pointee: DIType<'ctx>, tag: u32 ) -> DIDerivedType<'ctx>

Creates a pointer type

source

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

source

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>

source

pub fn create_constant_expression(&self, value: i64) -> DIExpression<'ctx>

source

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.

source

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.

source

pub fn create_namespace( &self, scope: DIScope<'ctx>, name: &str, export_symbols: bool ) -> DINamespace<'ctx>

source

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.

source

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

source

pub fn create_expression( &self, address_operations: Vec<i64> ) -> DIExpression<'ctx>

Create an expression

source

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.

source

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().

source

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.

source

pub fn finalize(&self)

Construct any deferred debug info descriptors. May generate invalid metadata if debug info is incomplete. Module/function verification can then fail.

Call before any kind of code generation (including verification). Can be called more than once.

Trait Implementations§

source§

impl<'ctx> Debug for DebugInfoBuilder<'ctx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'ctx> Drop for DebugInfoBuilder<'ctx>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'ctx> PartialEq for DebugInfoBuilder<'ctx>

source§

fn eq(&self, other: &DebugInfoBuilder<'ctx>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'ctx> Eq for DebugInfoBuilder<'ctx>

source§

impl<'ctx> StructuralPartialEq for DebugInfoBuilder<'ctx>

Auto Trait Implementations§

§

impl<'ctx> Freeze for DebugInfoBuilder<'ctx>

§

impl<'ctx> RefUnwindSafe for DebugInfoBuilder<'ctx>

§

impl<'ctx> !Send for DebugInfoBuilder<'ctx>

§

impl<'ctx> !Sync for DebugInfoBuilder<'ctx>

§

impl<'ctx> Unpin for DebugInfoBuilder<'ctx>

§

impl<'ctx> UnwindSafe for DebugInfoBuilder<'ctx>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.