Remove in_band_lifetimes from rustc_codegen_llvm

See #91867 for more information.
This commit is contained in:
LegionMammal978
2021-12-14 13:49:49 -05:00
committed by Matthew House
parent 1d01550f7e
commit 4937a55dfb
28 changed files with 429 additions and 392 deletions
+11 -11
View File
@@ -136,11 +136,11 @@ fn apply_attrs_to_callsite(
}
pub trait LlvmType {
fn llvm_type(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type;
fn llvm_type<'ll>(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type;
}
impl LlvmType for Reg {
fn llvm_type(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type {
fn llvm_type<'ll>(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type {
match self.kind {
RegKind::Integer => cx.type_ix(self.size.bits()),
RegKind::Float => match self.size.bits() {
@@ -154,7 +154,7 @@ fn llvm_type(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type {
}
impl LlvmType for CastTarget {
fn llvm_type(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type {
fn llvm_type<'ll>(&self, cx: &CodegenCx<'ll, '_>) -> &'ll Type {
let rest_ll_unit = self.rest.unit.llvm_type(cx);
let (rest_count, rem_bytes) = if self.rest.unit.size.bytes() == 0 {
(0, 0)
@@ -212,7 +212,7 @@ fn store_fn_arg(
);
}
impl ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
/// Gets the LLVM type for a place of the original Rust type of
/// this argument/return, i.e., the result of `type_of::type_of`.
fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
@@ -287,7 +287,7 @@ fn store(
fn store_fn_arg(
&self,
bx: &mut Builder<'a, 'll, 'tcx>,
bx: &mut Builder<'_, 'll, 'tcx>,
idx: &mut usize,
dst: PlaceRef<'tcx, &'ll Value>,
) {
@@ -314,7 +314,7 @@ fn store_fn_arg(
}
}
impl ArgAbiMethods<'tcx> for Builder<'a, 'll, 'tcx> {
impl<'ll, 'tcx> ArgAbiMethods<'tcx> for Builder<'_, 'll, 'tcx> {
fn store_fn_arg(
&mut self,
arg_abi: &ArgAbi<'tcx, Ty<'tcx>>,
@@ -336,15 +336,15 @@ fn arg_memory_ty(&self, arg_abi: &ArgAbi<'tcx, Ty<'tcx>>) -> &'ll Type {
}
}
pub trait FnAbiLlvmExt<'tcx> {
pub trait FnAbiLlvmExt<'ll, 'tcx> {
fn llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type;
fn ptr_to_llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type;
fn llvm_cconv(&self) -> llvm::CallConv;
fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value);
fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value);
fn apply_attrs_callsite(&self, bx: &mut Builder<'_, 'll, 'tcx>, callsite: &'ll Value);
}
impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
fn llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
// Ignore "extra" args from the call site for C variadic functions.
// Only the "fixed" args are part of the LLVM function signature.
@@ -505,7 +505,7 @@ fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) {
}
}
fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value) {
fn apply_attrs_callsite(&self, bx: &mut Builder<'_, 'll, 'tcx>, callsite: &'ll Value) {
if self.ret.layout.abi.is_uninhabited() {
llvm::Attribute::NoReturn.apply_callsite(llvm::AttributePlace::Function, callsite);
}
@@ -610,7 +610,7 @@ fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll V
}
}
impl AbiBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
impl<'tcx> AbiBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
fn apply_attrs_callsite(&mut self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, callsite: Self::Value) {
fn_abi.apply_attrs_callsite(self, callsite)
}
+12 -12
View File
@@ -23,7 +23,7 @@
use libc::{c_char, c_uint};
use tracing::debug;
impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
fn codegen_llvm_inline_asm(
&mut self,
ia: &hir::LlvmInlineAsmInner,
@@ -399,7 +399,7 @@ fn codegen_inline_asm(
}
}
impl AsmMethods for CodegenCx<'ll, 'tcx> {
impl AsmMethods for CodegenCx<'_, '_> {
fn codegen_global_asm(
&self,
template: &[InlineAsmTemplatePiece],
@@ -447,8 +447,8 @@ fn codegen_global_asm(
}
}
pub(crate) fn inline_asm_call(
bx: &mut Builder<'a, 'll, 'tcx>,
pub(crate) fn inline_asm_call<'ll>(
bx: &mut Builder<'_, 'll, '_>,
asm: &str,
cons: &str,
inputs: &[&'ll Value],
@@ -583,7 +583,7 @@ fn a64_vreg_index(reg: InlineAsmReg) -> Option<u32> {
}
/// Converts a register class to an LLVM constraint code.
fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'tcx>>) -> String {
fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) -> String {
match reg {
// For vector registers LLVM wants the register name to match the type size.
InlineAsmRegOrRegClass::Reg(reg) => {
@@ -773,7 +773,7 @@ fn modifier_to_llvm(
/// Type to use for outputs that are discarded. It doesn't really matter what
/// the type is, as long as it is valid for the constraint code.
fn dummy_output_type(cx: &CodegenCx<'ll, 'tcx>, reg: InlineAsmRegClass) -> &'ll Type {
fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'ll Type {
match reg {
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg)
@@ -841,7 +841,7 @@ fn dummy_output_type(cx: &CodegenCx<'ll, 'tcx>, reg: InlineAsmRegClass) -> &'ll
/// Helper function to get the LLVM type for a Scalar. Pointers are returned as
/// the equivalent integer type.
fn llvm_asm_scalar_type(cx: &CodegenCx<'ll, 'tcx>, scalar: Scalar) -> &'ll Type {
fn llvm_asm_scalar_type<'ll>(cx: &CodegenCx<'ll, '_>, scalar: Scalar) -> &'ll Type {
match scalar.value {
Primitive::Int(Integer::I8, _) => cx.type_i8(),
Primitive::Int(Integer::I16, _) => cx.type_i16(),
@@ -855,8 +855,8 @@ fn llvm_asm_scalar_type(cx: &CodegenCx<'ll, 'tcx>, scalar: Scalar) -> &'ll Type
}
/// Fix up an input value to work around LLVM bugs.
fn llvm_fixup_input(
bx: &mut Builder<'a, 'll, 'tcx>,
fn llvm_fixup_input<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
mut value: &'ll Value,
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
@@ -933,8 +933,8 @@ fn llvm_fixup_input(
}
/// Fix up an output value to work around LLVM bugs.
fn llvm_fixup_output(
bx: &mut Builder<'a, 'll, 'tcx>,
fn llvm_fixup_output<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
mut value: &'ll Value,
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
@@ -1009,7 +1009,7 @@ fn llvm_fixup_output(
}
/// Output type to use for llvm_fixup_output.
fn llvm_fixup_output_type(
fn llvm_fixup_output_type<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
+17 -13
View File
@@ -25,7 +25,7 @@
/// Mark LLVM function to use provided inline heuristic.
#[inline]
fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
fn inline<'ll>(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
use self::InlineAttr::*;
match inline {
Hint => Attribute::InlineHint.apply_llfn(Function, val),
@@ -41,7 +41,7 @@ fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
/// Apply LLVM sanitize attributes.
#[inline]
pub fn sanitize(cx: &CodegenCx<'ll, '_>, no_sanitize: SanitizerSet, llfn: &'ll Value) {
pub fn sanitize<'ll>(cx: &CodegenCx<'ll, '_>, no_sanitize: SanitizerSet, llfn: &'ll Value) {
let enabled = cx.tcx.sess.opts.debugging_opts.sanitizer - no_sanitize;
if enabled.contains(SanitizerSet::ADDRESS) {
llvm::Attribute::SanitizeAddress.apply_llfn(Function, llfn);
@@ -59,17 +59,17 @@ pub fn sanitize(cx: &CodegenCx<'ll, '_>, no_sanitize: SanitizerSet, llfn: &'ll V
/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
#[inline]
pub fn emit_uwtable(val: &'ll Value, emit: bool) {
pub fn emit_uwtable(val: &Value, emit: bool) {
Attribute::UWTable.toggle_llfn(Function, val, emit);
}
/// Tell LLVM if this function should be 'naked', i.e., skip the epilogue and prologue.
#[inline]
fn naked(val: &'ll Value, is_naked: bool) {
fn naked(val: &Value, is_naked: bool) {
Attribute::Naked.toggle_llfn(Function, val, is_naked);
}
pub fn set_frame_pointer_type(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
pub fn set_frame_pointer_type<'ll>(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
let mut fp = cx.sess().target.frame_pointer;
// "mcount" function relies on stack pointer.
// See <https://sourceware.org/binutils/docs/gprof/Implementation.html>.
@@ -92,7 +92,7 @@ pub fn set_frame_pointer_type(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
/// Tell LLVM what instrument function to insert.
#[inline]
fn set_instrument_function(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
fn set_instrument_function<'ll>(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
if cx.sess().instrument_mcount() {
// Similar to `clang -pg` behavior. Handled by the
// `post-inline-ee-instrument` LLVM pass.
@@ -110,7 +110,7 @@ fn set_instrument_function(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
}
}
fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
fn set_probestack<'ll>(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
// Currently stack probes seem somewhat incompatible with the address
// sanitizer and thread sanitizer. With asan we're already protected from
// stack overflow anyway so we don't really need stack probes regardless.
@@ -161,7 +161,7 @@ fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
}
}
fn set_stackprotector(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
fn set_stackprotector<'ll>(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
let sspattr = match cx.sess().stack_protector() {
StackProtector::None => return,
StackProtector::All => Attribute::StackProtectReq,
@@ -172,7 +172,7 @@ fn set_stackprotector(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
sspattr.apply_llfn(Function, llfn)
}
pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
pub fn apply_target_cpu_attr<'ll>(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
let target_cpu = SmallCStr::new(llvm_util::target_cpu(cx.tcx.sess));
llvm::AddFunctionAttrStringValue(
llfn,
@@ -182,7 +182,7 @@ pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
);
}
pub fn apply_tune_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
pub fn apply_tune_cpu_attr<'ll>(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
if let Some(tune) = llvm_util::tune_cpu(cx.tcx.sess) {
let tune_cpu = SmallCStr::new(tune);
llvm::AddFunctionAttrStringValue(
@@ -196,14 +196,14 @@ pub fn apply_tune_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
/// Sets the `NonLazyBind` LLVM attribute on a given function,
/// assuming the codegen options allow skipping the PLT.
pub fn non_lazy_bind(sess: &Session, llfn: &'ll Value) {
pub fn non_lazy_bind<'ll>(sess: &Session, llfn: &'ll Value) {
// Don't generate calls through PLT if it's not necessary
if !sess.needs_plt() {
Attribute::NonLazyBind.apply_llfn(Function, llfn);
}
}
pub(crate) fn default_optimisation_attrs(sess: &Session, llfn: &'ll Value) {
pub(crate) fn default_optimisation_attrs<'ll>(sess: &Session, llfn: &'ll Value) {
match sess.opts.optimize {
OptLevel::Size => {
llvm::Attribute::MinSize.unapply_llfn(Function, llfn);
@@ -226,7 +226,11 @@ pub(crate) fn default_optimisation_attrs(sess: &Session, llfn: &'ll Value) {
/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
/// attributes.
pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::Instance<'tcx>) {
pub fn from_fn_attrs<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
llfn: &'ll Value,
instance: ty::Instance<'tcx>,
) {
let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(instance.def_id());
match codegen_fn_attrs.optimize {
+2 -2
View File
@@ -363,7 +363,7 @@ fn fat_lto(
crate struct Linker<'a>(&'a mut llvm::Linker<'a>);
impl Linker<'a> {
impl<'a> Linker<'a> {
crate fn new(llmod: &'a llvm::Module) -> Self {
unsafe { Linker(llvm::LLVMRustLinkerNew(llmod)) }
}
@@ -383,7 +383,7 @@ impl Linker<'a> {
}
}
impl Drop for Linker<'a> {
impl Drop for Linker<'_> {
fn drop(&mut self) {
unsafe {
llvm::LLVMRustLinkerFree(&mut *(self.0 as *mut _));
@@ -46,7 +46,7 @@ pub fn llvm_err(handler: &rustc_errors::Handler, msg: &str) -> FatalError {
}
}
pub fn write_output_file(
pub fn write_output_file<'ll>(
handler: &rustc_errors::Handler,
target: &'ll llvm::TargetMachine,
pm: &llvm::PassManager<'ll>,
+3 -6
View File
@@ -39,7 +39,7 @@ pub struct ValueIter<'ll> {
step: unsafe extern "C" fn(&'ll Value) -> Option<&'ll Value>,
}
impl Iterator for ValueIter<'ll> {
impl<'ll> Iterator for ValueIter<'ll> {
type Item = &'ll Value;
fn next(&mut self) -> Option<&'ll Value> {
@@ -51,14 +51,11 @@ fn next(&mut self) -> Option<&'ll Value> {
}
}
pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> {
pub fn iter_globals(llmod: &llvm::Module) -> ValueIter<'_> {
unsafe { ValueIter { cur: llvm::LLVMGetFirstGlobal(llmod), step: llvm::LLVMGetNextGlobal } }
}
pub fn compile_codegen_unit(
tcx: TyCtxt<'tcx>,
cgu_name: Symbol,
) -> (ModuleCodegen<ModuleLlvm>, u64) {
pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen<ModuleLlvm>, u64) {
let start_time = Instant::now();
let dep_node = tcx.codegen_unit(cgu_name).codegen_dep_node(tcx);
+12 -12
View File
@@ -36,7 +36,7 @@ pub struct Builder<'a, 'll, 'tcx> {
pub cx: &'a CodegenCx<'ll, 'tcx>,
}
impl Drop for Builder<'a, 'll, 'tcx> {
impl Drop for Builder<'_, '_, '_> {
fn drop(&mut self) {
unsafe {
llvm::LLVMDisposeBuilder(&mut *(self.llbuilder as *mut _));
@@ -52,7 +52,7 @@ fn drop(&mut self) {
// FIXME(eddyb) pass `&CStr` directly to FFI once it's a thin pointer.
const UNNAMED: *const c_char = EMPTY_C_STR.as_ptr();
impl BackendTypes for Builder<'_, 'll, 'tcx> {
impl<'ll, 'tcx> BackendTypes for Builder<'_, 'll, 'tcx> {
type Value = <CodegenCx<'ll, 'tcx> as BackendTypes>::Value;
type Function = <CodegenCx<'ll, 'tcx> as BackendTypes>::Function;
type BasicBlock = <CodegenCx<'ll, 'tcx> as BackendTypes>::BasicBlock;
@@ -70,27 +70,27 @@ fn data_layout(&self) -> &abi::TargetDataLayout {
}
}
impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> {
impl<'tcx> ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> {
#[inline]
fn tcx(&self) -> TyCtxt<'tcx> {
self.cx.tcx
}
}
impl ty::layout::HasParamEnv<'tcx> for Builder<'_, '_, 'tcx> {
impl<'tcx> ty::layout::HasParamEnv<'tcx> for Builder<'_, '_, 'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
self.cx.param_env()
}
}
impl HasTargetSpec for Builder<'_, '_, 'tcx> {
impl HasTargetSpec for Builder<'_, '_, '_> {
#[inline]
fn target_spec(&self) -> &Target {
self.cx.target_spec()
}
}
impl LayoutOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
impl<'tcx> LayoutOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
type LayoutOfResult = TyAndLayout<'tcx>;
#[inline]
@@ -99,7 +99,7 @@ fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) ->
}
}
impl FnAbiOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
impl<'tcx> FnAbiOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>;
#[inline]
@@ -113,7 +113,7 @@ fn handle_fn_abi_err(
}
}
impl Deref for Builder<'_, 'll, 'tcx> {
impl<'ll, 'tcx> Deref for Builder<'_, 'll, 'tcx> {
type Target = CodegenCx<'ll, 'tcx>;
#[inline]
@@ -122,7 +122,7 @@ fn deref(&self) -> &Self::Target {
}
}
impl HasCodegen<'tcx> for Builder<'_, 'll, 'tcx> {
impl<'ll, 'tcx> HasCodegen<'tcx> for Builder<'_, 'll, 'tcx> {
type CodegenCx = CodegenCx<'ll, 'tcx>;
}
@@ -136,7 +136,7 @@ macro_rules! builder_methods_for_value_instructions {
}
}
impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
fn build(cx: &'a CodegenCx<'ll, 'tcx>, llbb: &'ll BasicBlock) -> Self {
let bx = Builder::with_cx(cx);
unsafe {
@@ -1206,14 +1206,14 @@ fn do_not_inline(&mut self, llret: &'ll Value) {
}
}
impl StaticBuilderMethods for Builder<'a, 'll, 'tcx> {
impl<'ll> StaticBuilderMethods for Builder<'_, 'll, '_> {
fn get_static(&mut self, def_id: DefId) -> &'ll Value {
// Forward to the `get_static` method of `CodegenCx`
self.cx().get_static(def_id)
}
}
impl Builder<'a, 'll, 'tcx> {
impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
fn with_cx(cx: &'a CodegenCx<'ll, 'tcx>) -> Self {
// Create a fresh builder from the crate context.
let llbuilder = unsafe { llvm::LLVMCreateBuilderInContext(cx.llcx) };
+1 -1
View File
@@ -22,7 +22,7 @@
///
/// - `cx`: the crate context
/// - `instance`: the instance to be instantiated
pub fn get_fn(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) -> &'ll Value {
pub fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) -> &'ll Value {
let tcx = cx.tcx();
debug!("get_fn(instance={:?})", instance);
+10 -6
View File
@@ -65,7 +65,7 @@ pub struct Funclet<'ll> {
operand: OperandBundleDef<'ll>,
}
impl Funclet<'ll> {
impl<'ll> Funclet<'ll> {
pub fn new(cleanuppad: &'ll Value) -> Self {
Funclet { cleanuppad, operand: OperandBundleDef::new("funclet", &[cleanuppad]) }
}
@@ -79,7 +79,7 @@ pub fn bundle(&self) -> &OperandBundleDef<'ll> {
}
}
impl BackendTypes for CodegenCx<'ll, 'tcx> {
impl<'ll> BackendTypes for CodegenCx<'ll, '_> {
type Value = &'ll Value;
// FIXME(eddyb) replace this with a `Function` "subclass" of `Value`.
type Function = &'ll Value;
@@ -93,7 +93,7 @@ impl BackendTypes for CodegenCx<'ll, 'tcx> {
type DIVariable = &'ll llvm::debuginfo::DIVariable;
}
impl CodegenCx<'ll, 'tcx> {
impl<'ll> CodegenCx<'ll, '_> {
pub fn const_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
unsafe { llvm::LLVMConstArray(ty, elts.as_ptr(), elts.len() as c_uint) }
}
@@ -145,7 +145,7 @@ pub fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value {
}
}
impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn const_null(&self, t: &'ll Type) -> &'ll Value {
unsafe { llvm::LLVMConstNull(t) }
}
@@ -327,14 +327,18 @@ pub fn val_ty(v: &Value) -> &Type {
unsafe { llvm::LLVMTypeOf(v) }
}
pub fn bytes_in_context(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
pub fn bytes_in_context<'ll>(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
unsafe {
let ptr = bytes.as_ptr() as *const c_char;
llvm::LLVMConstStringInContext(llcx, ptr, bytes.len() as c_uint, True)
}
}
pub fn struct_in_context(llcx: &'a llvm::Context, elts: &[&'a Value], packed: bool) -> &'a Value {
pub fn struct_in_context<'ll>(
llcx: &'ll llvm::Context,
elts: &[&'ll Value],
packed: bool,
) -> &'ll Value {
unsafe {
llvm::LLVMConstStructInContext(llcx, elts.as_ptr(), elts.len() as c_uint, packed as Bool)
}
+7 -7
View File
@@ -24,7 +24,7 @@
use std::ops::Range;
use tracing::debug;
pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll Value {
pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll Value {
let mut llvals = Vec::with_capacity(alloc.relocations().len() + 1);
let dl = cx.data_layout();
let pointer_size = dl.pointer_size.bytes() as usize;
@@ -127,7 +127,7 @@ fn append_chunks_of_init_and_uninit_bytes<'ll, 'a, 'b>(
cx.const_struct(&llvals, true)
}
pub fn codegen_static_initializer(
pub fn codegen_static_initializer<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
def_id: DefId,
) -> Result<(&'ll Value, &'tcx Allocation), ErrorHandled> {
@@ -135,7 +135,7 @@ pub fn codegen_static_initializer(
Ok((const_alloc_to_llvm(cx, alloc), alloc))
}
fn set_global_alignment(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, mut align: Align) {
fn set_global_alignment<'ll>(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, mut align: Align) {
// The target may require greater alignment for globals than the type does.
// Note: GCC and Clang also allow `__attribute__((aligned))` on variables,
// which can force it to be smaller. Rust doesn't support this yet.
@@ -152,7 +152,7 @@ fn set_global_alignment(cx: &CodegenCx<'ll, '_>, gv: &'ll Value, mut align: Alig
}
}
fn check_and_apply_linkage(
fn check_and_apply_linkage<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
attrs: &CodegenFnAttrs,
ty: Ty<'tcx>,
@@ -206,11 +206,11 @@ fn check_and_apply_linkage(
}
}
pub fn ptrcast(val: &'ll Value, ty: &'ll Type) -> &'ll Value {
pub fn ptrcast<'ll>(val: &'ll Value, ty: &'ll Type) -> &'ll Value {
unsafe { llvm::LLVMConstPointerCast(val, ty) }
}
impl CodegenCx<'ll, 'tcx> {
impl<'ll> CodegenCx<'ll, '_> {
crate fn const_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
unsafe { llvm::LLVMConstBitCast(val, ty) }
}
@@ -344,7 +344,7 @@ impl CodegenCx<'ll, 'tcx> {
}
}
impl StaticMethods for CodegenCx<'ll, 'tcx> {
impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
fn static_addr_of(&self, cv: &'ll Value, align: Align, kind: Option<&str>) -> &'ll Value {
if let Some(&gv) = self.const_globals.borrow().get(&cv) {
unsafe {
+16 -16
View File
@@ -124,7 +124,7 @@ fn to_llvm_tls_model(tls_model: TlsModel) -> llvm::ThreadLocalMode {
}
}
pub unsafe fn create_module(
pub unsafe fn create_module<'ll>(
tcx: TyCtxt<'_>,
llcx: &'ll llvm::Context,
mod_name: &str,
@@ -363,7 +363,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
}
#[inline]
pub fn coverage_context(&'a self) -> Option<&'a coverageinfo::CrateCoverageContext<'ll, 'tcx>> {
pub fn coverage_context(&self) -> Option<&coverageinfo::CrateCoverageContext<'ll, 'tcx>> {
self.coverage_cx.as_ref()
}
@@ -380,7 +380,7 @@ fn create_used_variable_impl(&self, name: &'static CStr, values: &[&'ll Value])
}
}
impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn vtables(
&self,
) -> &RefCell<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), &'ll Value>>
@@ -504,8 +504,8 @@ fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
}
}
impl CodegenCx<'b, 'tcx> {
crate fn get_intrinsic(&self, key: &str) -> (&'b Type, &'b Value) {
impl<'ll> CodegenCx<'ll, '_> {
crate fn get_intrinsic(&self, key: &str) -> (&'ll Type, &'ll Value) {
if let Some(v) = self.intrinsics.borrow().get(key).cloned() {
return v;
}
@@ -516,9 +516,9 @@ impl CodegenCx<'b, 'tcx> {
fn insert_intrinsic(
&self,
name: &'static str,
args: Option<&[&'b llvm::Type]>,
ret: &'b llvm::Type,
) -> (&'b llvm::Type, &'b llvm::Value) {
args: Option<&[&'ll llvm::Type]>,
ret: &'ll llvm::Type,
) -> (&'ll llvm::Type, &'ll llvm::Value) {
let fn_ty = if let Some(args) = args {
self.type_func(args, ret)
} else {
@@ -529,7 +529,7 @@ fn insert_intrinsic(
(fn_ty, f)
}
fn declare_intrinsic(&self, key: &str) -> Option<(&'b Type, &'b Value)> {
fn declare_intrinsic(&self, key: &str) -> Option<(&'ll Type, &'ll Value)> {
macro_rules! ifn {
($name:expr, fn() -> $ret:expr) => (
if key == $name {
@@ -793,7 +793,7 @@ macro_rules! mk_struct {
None
}
crate fn eh_catch_typeinfo(&self) -> &'b Value {
crate fn eh_catch_typeinfo(&self) -> &'ll Value {
if let Some(eh_catch_typeinfo) = self.eh_catch_typeinfo.get() {
return eh_catch_typeinfo;
}
@@ -813,7 +813,7 @@ macro_rules! mk_struct {
}
}
impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
impl CodegenCx<'_, '_> {
/// Generates a new symbol name with the given prefix. This symbol name must
/// only be used for definitions with `internal` or `private` linkage.
pub fn generate_local_symbol_name(&self, prefix: &str) -> String {
@@ -829,21 +829,21 @@ pub fn generate_local_symbol_name(&self, prefix: &str) -> String {
}
}
impl HasDataLayout for CodegenCx<'ll, 'tcx> {
impl HasDataLayout for CodegenCx<'_, '_> {
#[inline]
fn data_layout(&self) -> &TargetDataLayout {
&self.tcx.data_layout
}
}
impl HasTargetSpec for CodegenCx<'ll, 'tcx> {
impl HasTargetSpec for CodegenCx<'_, '_> {
#[inline]
fn target_spec(&self) -> &Target {
&self.tcx.sess.target
}
}
impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'tcx> ty::layout::HasTyCtxt<'tcx> for CodegenCx<'_, 'tcx> {
#[inline]
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
@@ -856,7 +856,7 @@ fn param_env(&self) -> ty::ParamEnv<'tcx> {
}
}
impl LayoutOfHelpers<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
type LayoutOfResult = TyAndLayout<'tcx>;
#[inline]
@@ -869,7 +869,7 @@ fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) ->
}
}
impl FnAbiOfHelpers<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>;
#[inline]
@@ -141,7 +141,7 @@ fn new(tcx: TyCtxt<'_>, version: u32) -> Self {
/// the `mapping_regions` and `virtual_file_mapping`, and capture any new filenames. Then use
/// LLVM APIs to encode the `virtual_file_mapping`, `expressions`, and `mapping_regions` into
/// the given `coverage_mapping` byte buffer, compliant with the LLVM Coverage Mapping format.
fn write_coverage_mapping(
fn write_coverage_mapping<'a>(
&mut self,
expressions: Vec<CounterExpression>,
counter_regions: impl Iterator<Item = (Counter, &'a CodeRegion)>,
@@ -200,9 +200,9 @@ fn write_coverage_mapping(
/// Construct coverage map header and the array of function records, and combine them into the
/// coverage map. Save the coverage map data into the LLVM IR as a static global using a
/// specific, well-known section and name.
fn generate_coverage_map(
fn generate_coverage_map<'ll>(
self,
cx: &CodegenCx<'ll, 'tcx>,
cx: &CodegenCx<'ll, '_>,
version: u32,
filenames_size: usize,
filenames_val: &'ll llvm::Value,
@@ -229,7 +229,7 @@ fn generate_coverage_map(
/// Save the function record into the LLVM IR as a static global using a
/// specific, well-known section and name.
fn save_function_record(
cx: &CodegenCx<'ll, 'tcx>,
cx: &CodegenCx<'_, '_>,
mangled_function_name: String,
source_hash: u64,
filenames_ref: u64,
@@ -56,7 +56,7 @@ pub fn take_function_coverage_map(&self) -> FxHashMap<Instance<'tcx>, FunctionCo
}
}
impl CoverageInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> CoverageInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn coverageinfo_finalize(&self) {
mapgen::finalize(self)
}
@@ -96,7 +96,7 @@ fn define_unused_fn(&self, def_id: DefId) {
}
}
impl CoverageInfoBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
fn set_function_source_hash(
&mut self,
instance: Instance<'tcx>,
@@ -184,7 +184,7 @@ fn add_coverage_unreachable(&mut self, instance: Instance<'tcx>, region: CodeReg
}
}
fn declare_unused_fn(cx: &CodegenCx<'ll, 'tcx>, def_id: &DefId) -> Instance<'tcx> {
fn declare_unused_fn<'tcx>(cx: &CodegenCx<'_, 'tcx>, def_id: &DefId) -> Instance<'tcx> {
let tcx = cx.tcx;
let instance = Instance::new(
@@ -220,7 +220,7 @@ fn declare_unused_fn(cx: &CodegenCx<'ll, 'tcx>, def_id: &DefId) -> Instance<'tcx
instance
}
fn codegen_unused_fn_and_counter(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) {
fn codegen_unused_fn_and_counter<'tcx>(cx: &CodegenCx<'_, 'tcx>, instance: Instance<'tcx>) {
let llfn = cx.get_fn(instance);
let llbb = Builder::append_block(cx, llfn, "unused_function");
let mut bx = Builder::build(cx, llbb);
@@ -237,8 +237,8 @@ fn codegen_unused_fn_and_counter(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'
bx.ret_void();
}
fn add_unused_function_coverage(
cx: &CodegenCx<'ll, 'tcx>,
fn add_unused_function_coverage<'tcx>(
cx: &CodegenCx<'_, 'tcx>,
instance: Instance<'tcx>,
def_id: DefId,
) {
@@ -268,7 +268,7 @@ fn add_unused_function_coverage(
/// required by LLVM InstrProf source-based coverage instrumentation. Use
/// `bx.get_pgo_func_name_var()` to ensure the variable is only created once per
/// `Instance`.
fn create_pgo_func_name_var(
fn create_pgo_func_name_var<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
instance: Instance<'tcx>,
) -> &'ll llvm::Value {
@@ -16,7 +16,7 @@
/// Produces DIScope DIEs for each MIR Scope which has variables defined in it.
// FIXME(eddyb) almost all of this should be in `rustc_codegen_ssa::mir::debuginfo`.
pub fn compute_mir_scopes(
pub fn compute_mir_scopes<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
instance: Instance<'tcx>,
mir: &Body<'tcx>,
@@ -45,7 +45,7 @@ pub fn compute_mir_scopes(
}
}
fn make_mir_scope(
fn make_mir_scope<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
instance: Instance<'tcx>,
mir: &Body<'tcx>,
@@ -28,7 +28,7 @@ pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &mut Builder<'_,
/// Allocates the global variable responsible for the .debug_gdb_scripts binary
/// section.
pub fn get_or_insert_gdb_debug_scripts_section_global(cx: &CodegenCx<'ll, '_>) -> &'ll Value {
pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, '_>) -> &'ll Value {
let c_section_var_name = "__rustc_debug_gdb_scripts_section__\0";
let section_var_name = &c_section_var_name[..c_section_var_name.len() - 1];
@@ -155,7 +155,7 @@ pub struct TypeMap<'ll, 'tcx> {
type_to_unique_id: FxHashMap<Ty<'tcx>, UniqueTypeId>,
}
impl TypeMap<'ll, 'tcx> {
impl<'ll, 'tcx> TypeMap<'ll, 'tcx> {
/// Adds a Ty to metadata mapping to the TypeMap. The method will fail if
/// the mapping already exists.
fn register_type_with_metadata(&mut self, type_: Ty<'tcx>, metadata: &'ll DIType) {
@@ -291,7 +291,7 @@ enum RecursiveTypeDescription<'ll, 'tcx> {
FinalMetadata(&'ll DICompositeType),
}
fn create_and_register_recursive_type_forward_declaration(
fn create_and_register_recursive_type_forward_declaration<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unfinished_type: Ty<'tcx>,
unique_type_id: UniqueTypeId,
@@ -313,7 +313,7 @@ fn create_and_register_recursive_type_forward_declaration(
}
}
impl RecursiveTypeDescription<'ll, 'tcx> {
impl<'ll, 'tcx> RecursiveTypeDescription<'ll, 'tcx> {
/// Finishes up the description of the type in question (mostly by providing
/// descriptions of the fields of the given type) and returns the final type
/// metadata.
@@ -375,7 +375,7 @@ macro_rules! return_if_metadata_created_in_meantime {
};
}
fn fixed_vec_metadata(
fn fixed_vec_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unique_type_id: UniqueTypeId,
array_or_slice_type: Ty<'tcx>,
@@ -410,7 +410,7 @@ fn fixed_vec_metadata(
MetadataCreationResult::new(metadata, false)
}
fn vec_slice_metadata(
fn vec_slice_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
slice_ptr_type: Ty<'tcx>,
element_type: Ty<'tcx>,
@@ -466,7 +466,7 @@ fn vec_slice_metadata(
MetadataCreationResult::new(metadata, false)
}
fn subroutine_type_metadata(
fn subroutine_type_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unique_type_id: UniqueTypeId,
signature: ty::PolyFnSig<'tcx>,
@@ -507,7 +507,7 @@ fn subroutine_type_metadata(
// `trait_type` should be the actual trait (e.g., `Trait`). Where the trait is part
// of a DST struct, there is no `trait_object_type` and the results of this
// function will be a little bit weird.
fn trait_pointer_metadata(
fn trait_pointer_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
trait_type: Ty<'tcx>,
trait_object_type: Option<Ty<'tcx>>,
@@ -588,7 +588,11 @@ fn trait_pointer_metadata(
)
}
pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Span) -> &'ll DIType {
pub fn type_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
t: Ty<'tcx>,
usage_site_span: Span,
) -> &'ll DIType {
// Get the unique type ID of this type.
let unique_type_id = {
let mut type_map = debug_context(cx).type_map.borrow_mut();
@@ -812,7 +816,7 @@ fn hex_encode(data: &[u8]) -> String {
hex_string
}
pub fn file_metadata(cx: &CodegenCx<'ll, '_>, source_file: &SourceFile) -> &'ll DIFile {
pub fn file_metadata<'ll>(cx: &CodegenCx<'ll, '_>, source_file: &SourceFile) -> &'ll DIFile {
debug!("file_metadata: file_name: {:?}", source_file.name);
let hash = Some(&source_file.src_hash);
@@ -833,11 +837,11 @@ pub fn file_metadata(cx: &CodegenCx<'ll, '_>, source_file: &SourceFile) -> &'ll
file_metadata_raw(cx, file_name, directory, hash)
}
pub fn unknown_file_metadata(cx: &CodegenCx<'ll, '_>) -> &'ll DIFile {
pub fn unknown_file_metadata<'ll>(cx: &CodegenCx<'ll, '_>) -> &'ll DIFile {
file_metadata_raw(cx, None, None, None)
}
fn file_metadata_raw(
fn file_metadata_raw<'ll>(
cx: &CodegenCx<'ll, '_>,
file_name: Option<String>,
directory: Option<String>,
@@ -924,7 +928,7 @@ fn msvc_basic_name(self) -> &'static str {
}
}
fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
fn basic_type_metadata<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
debug!("basic_type_metadata: {:?}", t);
// When targeting MSVC, emit MSVC style type names for compatibility with
@@ -981,7 +985,7 @@ fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
typedef_metadata
}
fn foreign_type_metadata(
fn foreign_type_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
t: Ty<'tcx>,
unique_type_id: UniqueTypeId,
@@ -992,7 +996,7 @@ fn foreign_type_metadata(
create_struct_stub(cx, t, &name, unique_type_id, NO_SCOPE_METADATA, DIFlags::FlagZero)
}
fn pointer_type_metadata(
fn pointer_type_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
pointer_type: Ty<'tcx>,
pointee_type_metadata: &'ll DIType,
@@ -1012,7 +1016,7 @@ fn pointer_type_metadata(
}
}
fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
fn param_type_metadata<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
debug!("param_type_metadata: {:?}", t);
let name = format!("{:?}", t);
unsafe {
@@ -1026,10 +1030,10 @@ fn param_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
}
}
pub fn compile_unit_metadata(
tcx: TyCtxt<'_>,
pub fn compile_unit_metadata<'ll, 'tcx>(
tcx: TyCtxt<'tcx>,
codegen_unit_name: &str,
debug_context: &CrateDebugContext<'ll, '_>,
debug_context: &CrateDebugContext<'ll, 'tcx>,
) -> &'ll DIDescriptor {
let mut name_in_debuginfo = match tcx.sess.local_crate_source_file {
Some(ref path) => path.clone(),
@@ -1159,7 +1163,7 @@ pub fn compile_unit_metadata(
return unit_metadata;
};
fn path_to_mdstring(llcx: &'ll llvm::Context, path: &Path) -> &'ll Value {
fn path_to_mdstring<'ll>(llcx: &'ll llvm::Context, path: &Path) -> &'ll Value {
let path_str = path_to_c_string(path);
unsafe {
llvm::LLVMMDStringInContext(
@@ -1176,7 +1180,7 @@ struct MetadataCreationResult<'ll> {
already_stored_in_typemap: bool,
}
impl MetadataCreationResult<'ll> {
impl<'ll> MetadataCreationResult<'ll> {
fn new(metadata: &'ll DIType, already_stored_in_typemap: bool) -> Self {
MetadataCreationResult { metadata, already_stored_in_typemap }
}
@@ -1243,7 +1247,7 @@ enum MemberDescriptionFactory<'ll, 'tcx> {
VariantMDF(VariantMemberDescriptionFactory<'tcx>),
}
impl MemberDescriptionFactory<'ll, 'tcx> {
impl<'ll, 'tcx> MemberDescriptionFactory<'ll, 'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
match *self {
StructMDF(ref this) => this.create_member_descriptions(cx),
@@ -1267,7 +1271,10 @@ struct StructMemberDescriptionFactory<'tcx> {
}
impl<'tcx> StructMemberDescriptionFactory<'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
fn create_member_descriptions<'ll>(
&self,
cx: &CodegenCx<'ll, 'tcx>,
) -> Vec<MemberDescription<'ll>> {
let layout = cx.layout_of(self.ty);
self.variant
.fields
@@ -1295,7 +1302,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDes
}
}
fn prepare_struct_metadata(
fn prepare_struct_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
struct_type: Ty<'tcx>,
unique_type_id: UniqueTypeId,
@@ -1338,7 +1345,7 @@ fn prepare_struct_metadata(
/// Here are some examples:
/// - `name__field1__field2` when the upvar is captured by value.
/// - `_ref__name__field` when the upvar is captured by reference.
fn closure_saved_names_of_captured_variables(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<String> {
fn closure_saved_names_of_captured_variables(tcx: TyCtxt<'_>, def_id: DefId) -> Vec<String> {
let body = tcx.optimized_mir(def_id);
body.var_debug_info
@@ -1366,7 +1373,10 @@ struct TupleMemberDescriptionFactory<'tcx> {
}
impl<'tcx> TupleMemberDescriptionFactory<'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
fn create_member_descriptions<'ll>(
&self,
cx: &CodegenCx<'ll, 'tcx>,
) -> Vec<MemberDescription<'ll>> {
let mut capture_names = match *self.ty.kind() {
ty::Generator(def_id, ..) | ty::Closure(def_id, ..) => {
Some(closure_saved_names_of_captured_variables(cx.tcx, def_id).into_iter())
@@ -1399,7 +1409,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDes
}
}
fn prepare_tuple_metadata(
fn prepare_tuple_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
tuple_type: Ty<'tcx>,
component_types: &[Ty<'tcx>],
@@ -1443,7 +1453,10 @@ struct UnionMemberDescriptionFactory<'tcx> {
}
impl<'tcx> UnionMemberDescriptionFactory<'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
fn create_member_descriptions<'ll>(
&self,
cx: &CodegenCx<'ll, 'tcx>,
) -> Vec<MemberDescription<'ll>> {
self.variant
.fields
.iter()
@@ -1465,7 +1478,7 @@ fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDes
}
}
fn prepare_union_metadata(
fn prepare_union_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
union_type: Ty<'tcx>,
unique_type_id: UniqueTypeId,
@@ -1506,7 +1519,7 @@ fn use_enum_fallback(cx: &CodegenCx<'_, '_>) -> bool {
// FIXME(eddyb) maybe precompute this? Right now it's computed once
// per generator monomorphization, but it doesn't depend on substs.
fn generator_layout_and_saved_local_names(
fn generator_layout_and_saved_local_names<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: DefId,
) -> (&'tcx GeneratorLayout<'tcx>, IndexVec<mir::GeneratorSavedLocal, Option<Symbol>>) {
@@ -1554,7 +1567,7 @@ struct EnumMemberDescriptionFactory<'ll, 'tcx> {
span: Span,
}
impl EnumMemberDescriptionFactory<'ll, 'tcx> {
impl<'ll, 'tcx> EnumMemberDescriptionFactory<'ll, 'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
let generator_variant_info_data = match *self.enum_type.kind() {
ty::Generator(def_id, ..) => {
@@ -1886,8 +1899,11 @@ struct VariantMemberDescriptionFactory<'tcx> {
span: Span,
}
impl VariantMemberDescriptionFactory<'tcx> {
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>) -> Vec<MemberDescription<'ll>> {
impl<'tcx> VariantMemberDescriptionFactory<'tcx> {
fn create_member_descriptions<'ll>(
&self,
cx: &CodegenCx<'ll, 'tcx>,
) -> Vec<MemberDescription<'ll>> {
self.args
.iter()
.enumerate()
@@ -1961,7 +1977,7 @@ fn field_name(&self, i: usize) -> String {
field_name.map(|name| name.to_string()).unwrap_or_else(|| format!("__{}", i))
}
fn source_info(&self, cx: &CodegenCx<'ll, 'tcx>) -> Option<SourceInfo<'ll>> {
fn source_info<'ll>(&self, cx: &CodegenCx<'ll, 'tcx>) -> Option<SourceInfo<'ll>> {
if let VariantInfo::Generator { def_id, variant_index, .. } = self {
let span =
cx.tcx.generator_layout(*def_id).unwrap().variant_source_info[*variant_index].span;
@@ -1978,7 +1994,7 @@ fn source_info(&self, cx: &CodegenCx<'ll, 'tcx>) -> Option<SourceInfo<'ll>> {
/// `MemberDescriptionFactory` for producing the descriptions of the
/// fields of the variant. This is a rudimentary version of a full
/// `RecursiveTypeDescription`.
fn describe_enum_variant(
fn describe_enum_variant<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
layout: layout::TyAndLayout<'tcx>,
variant: VariantInfo<'_, 'tcx>,
@@ -2011,7 +2027,7 @@ fn describe_enum_variant(
(metadata_stub, member_description_factory)
}
fn prepare_enum_metadata(
fn prepare_enum_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
enum_type: Ty<'tcx>,
enum_def_id: DefId,
@@ -2330,7 +2346,7 @@ fn prepare_enum_metadata(
/// results in a LLVM struct.
///
/// Examples of Rust types to use this are: structs, tuples, boxes, vecs, and enums.
fn composite_type_metadata(
fn composite_type_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
composite_type: Ty<'tcx>,
composite_type_name: &str,
@@ -2364,7 +2380,7 @@ fn composite_type_metadata(
composite_type_metadata
}
fn set_members_of_composite_type(
fn set_members_of_composite_type<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
composite_type: Ty<'tcx>,
composite_type_metadata: &'ll DICompositeType,
@@ -2409,7 +2425,7 @@ fn set_members_of_composite_type(
}
/// Computes the type parameters for a type, if any, for the given metadata.
fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> &'ll DIArray {
fn compute_type_parameters<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> &'ll DIArray {
if let ty::Adt(def, substs) = *ty.kind() {
if substs.types().next().is_some() {
let generics = cx.tcx.generics_of(def.did);
@@ -2454,7 +2470,7 @@ fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec<S
/// A convenience wrapper around `LLVMRustDIBuilderCreateStructType()`. Does not do
/// any caching, does not add any fields to the struct. This can be done later
/// with `set_members_of_composite_type()`.
fn create_struct_stub(
fn create_struct_stub<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
struct_type: Ty<'tcx>,
struct_type_name: &str,
@@ -2495,7 +2511,7 @@ fn create_struct_stub(
metadata_stub
}
fn create_union_stub(
fn create_union_stub<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
union_type: Ty<'tcx>,
union_type_name: &str,
@@ -2536,7 +2552,7 @@ fn create_union_stub(
/// Creates debug information for the given global variable.
///
/// Adds the created metadata nodes directly to the crate's IR.
pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global: &'ll Value) {
pub fn create_global_var_metadata<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId, global: &'ll Value) {
if cx.dbg_cx.is_none() {
return;
}
@@ -2591,7 +2607,7 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
}
/// Generates LLVM debuginfo for a vtable.
fn vtable_type_metadata(
fn vtable_type_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
ty: Ty<'tcx>,
poly_trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
@@ -2623,7 +2639,7 @@ fn vtable_type_metadata(
/// given type.
///
/// Adds the created metadata nodes directly to the crate's IR.
pub fn create_vtable_metadata(
pub fn create_vtable_metadata<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
ty: Ty<'tcx>,
poly_trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
@@ -2662,7 +2678,7 @@ pub fn create_vtable_metadata(
}
/// Creates an "extension" of an existing `DIScope` into another file.
pub fn extend_scope_to_file(
pub fn extend_scope_to_file<'ll>(
cx: &CodegenCx<'ll, '_>,
scope_metadata: &'ll DIScope,
file: &SourceFile,
@@ -71,7 +71,7 @@ pub struct CrateDebugContext<'a, 'tcx> {
composite_types_completed: RefCell<FxHashSet<&'a DIType>>,
}
impl Drop for CrateDebugContext<'a, 'tcx> {
impl Drop for CrateDebugContext<'_, '_> {
fn drop(&mut self) {
unsafe {
llvm::LLVMRustDIBuilderDispose(&mut *(self.builder as *mut _));
@@ -144,7 +144,7 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
}
}
impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
// FIXME(eddyb) find a common convention for all of the debuginfo-related
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
fn dbg_var_addr(
@@ -236,7 +236,7 @@ pub struct DebugLoc {
pub col: u32,
}
impl CodegenCx<'ll, '_> {
impl CodegenCx<'_, '_> {
/// Looks up debug source information about a `BytePos`.
// FIXME(eddyb) rename this to better indicate it's a duplicate of
// `lookup_char_pos` rather than `dbg_loc`, perhaps by making
@@ -266,7 +266,7 @@ pub fn lookup_debug_loc(&self, pos: BytePos) -> DebugLoc {
}
}
impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn create_function_debug_context(
&self,
instance: Instance<'tcx>,
@@ -17,7 +17,7 @@ pub fn mangled_name_of_instance<'a, 'tcx>(
tcx.symbol_name(instance)
}
pub fn item_namespace(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
pub fn item_namespace<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
if let Some(&scope) = debug_context(cx).namespace_map.borrow().get(&def_id) {
return scope;
}
@@ -23,21 +23,26 @@ pub fn is_node_local_to_unit(cx: &CodegenCx<'_, '_>, def_id: DefId) -> bool {
}
#[allow(non_snake_case)]
pub fn create_DIArray(builder: &DIBuilder<'ll>, arr: &[Option<&'ll DIDescriptor>]) -> &'ll DIArray {
pub fn create_DIArray<'ll>(
builder: &DIBuilder<'ll>,
arr: &[Option<&'ll DIDescriptor>],
) -> &'ll DIArray {
unsafe { llvm::LLVMRustDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32) }
}
#[inline]
pub fn debug_context(cx: &'a CodegenCx<'ll, 'tcx>) -> &'a CrateDebugContext<'ll, 'tcx> {
pub fn debug_context<'a, 'll, 'tcx>(
cx: &'a CodegenCx<'ll, 'tcx>,
) -> &'a CrateDebugContext<'ll, 'tcx> {
cx.dbg_cx.as_ref().unwrap()
}
#[inline]
#[allow(non_snake_case)]
pub fn DIB(cx: &'a CodegenCx<'ll, '_>) -> &'a DIBuilder<'ll> {
pub fn DIB<'a, 'll>(cx: &'a CodegenCx<'ll, '_>) -> &'a DIBuilder<'ll> {
cx.dbg_cx.as_ref().unwrap().builder
}
pub fn get_namespace_for_item(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
pub fn get_namespace_for_item<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
item_namespace(cx, cx.tcx.parent(def_id).expect("get_namespace_for_item: missing parent?"))
}
+2 -2
View File
@@ -26,7 +26,7 @@
///
/// If theres a value with the same name already declared, the function will
/// update the declaration and return existing Value instead.
fn declare_raw_fn(
fn declare_raw_fn<'ll>(
cx: &CodegenCx<'ll, '_>,
name: &str,
callconv: llvm::CallConv,
@@ -50,7 +50,7 @@ fn declare_raw_fn(
llfn
}
impl CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
/// Declare a global value.
///
/// If theres a value with the same name already declared, the function will
+19 -16
View File
@@ -25,7 +25,10 @@
use std::cmp::Ordering;
use std::iter;
fn get_simple_intrinsic(cx: &CodegenCx<'ll, '_>, name: Symbol) -> Option<(&'ll Type, &'ll Value)> {
fn get_simple_intrinsic<'ll>(
cx: &CodegenCx<'ll, '_>,
name: Symbol,
) -> Option<(&'ll Type, &'ll Value)> {
let llvm_name = match name {
sym::sqrtf32 => "llvm.sqrt.f32",
sym::sqrtf64 => "llvm.sqrt.f64",
@@ -74,7 +77,7 @@ fn get_simple_intrinsic(cx: &CodegenCx<'ll, '_>, name: Symbol) -> Option<(&'ll T
Some(cx.get_intrinsic(llvm_name))
}
impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
fn codegen_intrinsic_call(
&mut self,
instance: ty::Instance<'tcx>,
@@ -411,8 +414,8 @@ fn va_end(&mut self, va_list: &'ll Value) -> &'ll Value {
}
}
fn try_intrinsic(
bx: &mut Builder<'a, 'll, 'tcx>,
fn try_intrinsic<'ll>(
bx: &mut Builder<'_, 'll, '_>,
try_func: &'ll Value,
data: &'ll Value,
catch_func: &'ll Value,
@@ -441,8 +444,8 @@ fn try_intrinsic(
// instructions are meant to work for all targets, as of the time of this
// writing, however, LLVM does not recommend the usage of these new instructions
// as the old ones are still more optimized.
fn codegen_msvc_try(
bx: &mut Builder<'a, 'll, 'tcx>,
fn codegen_msvc_try<'ll>(
bx: &mut Builder<'_, 'll, '_>,
try_func: &'ll Value,
data: &'ll Value,
catch_func: &'ll Value,
@@ -593,8 +596,8 @@ fn codegen_msvc_try(
// function calling it, and that function may already have other personality
// functions in play. By calling a shim we're guaranteed that our shim will have
// the right personality function.
fn codegen_gnu_try(
bx: &mut Builder<'a, 'll, 'tcx>,
fn codegen_gnu_try<'ll>(
bx: &mut Builder<'_, 'll, '_>,
try_func: &'ll Value,
data: &'ll Value,
catch_func: &'ll Value,
@@ -649,8 +652,8 @@ fn codegen_gnu_try(
// Variant of codegen_gnu_try used for emscripten where Rust panics are
// implemented using C++ exceptions. Here we use exceptions of a specific type
// (`struct rust_panic`) to represent Rust panics.
fn codegen_emcc_try(
bx: &mut Builder<'a, 'll, 'tcx>,
fn codegen_emcc_try<'ll>(
bx: &mut Builder<'_, 'll, '_>,
try_func: &'ll Value,
data: &'ll Value,
catch_func: &'ll Value,
@@ -799,8 +802,8 @@ fn get_rust_try_fn<'ll, 'tcx>(
rust_try
}
fn generic_simd_intrinsic(
bx: &mut Builder<'a, 'll, 'tcx>,
fn generic_simd_intrinsic<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
name: Symbol,
callee_ty: Ty<'tcx>,
args: &[OperandRef<'tcx, &'ll Value>],
@@ -1129,12 +1132,12 @@ macro_rules! require_simd {
}
}
fn simd_simple_float_intrinsic(
fn simd_simple_float_intrinsic<'ll, 'tcx>(
name: Symbol,
in_elem: &::rustc_middle::ty::TyS<'_>,
in_ty: &::rustc_middle::ty::TyS<'_>,
in_len: u64,
bx: &mut Builder<'a, 'll, 'tcx>,
bx: &mut Builder<'_, 'll, 'tcx>,
span: Span,
args: &[OperandRef<'tcx, &'ll Value>],
) -> Result<&'ll Value, ()> {
@@ -1232,7 +1235,7 @@ fn llvm_vector_str(
elem_ty: Ty<'_>,
vec_len: u64,
no_pointers: usize,
bx: &Builder<'a, 'll, 'tcx>,
bx: &Builder<'_, '_, '_>,
) -> String {
let p0s: String = "p0".repeat(no_pointers);
match *elem_ty.kind() {
@@ -1255,7 +1258,7 @@ fn llvm_vector_str(
}
}
fn llvm_vector_ty(
fn llvm_vector_ty<'ll>(
cx: &CodegenCx<'ll, '_>,
elem_ty: Ty<'_>,
vec_len: u64,
-1
View File
@@ -8,7 +8,6 @@
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(extern_types)]
#![feature(in_band_lifetimes)]
#![feature(nll)]
#![recursion_limit = "256"]
@@ -43,7 +43,7 @@ pub struct OptimizationDiagnostic<'ll> {
pub message: String,
}
impl OptimizationDiagnostic<'ll> {
impl<'ll> OptimizationDiagnostic<'ll> {
unsafe fn unpack(kind: OptimizationDiagnosticKind, di: &'ll DiagnosticInfo) -> Self {
let mut function = None;
let mut line = 0;
@@ -142,7 +142,7 @@ pub struct InlineAsmDiagnostic {
}
impl InlineAsmDiagnostic {
unsafe fn unpackInlineAsm(di: &'ll DiagnosticInfo) -> Self {
unsafe fn unpackInlineAsm(di: &DiagnosticInfo) -> Self {
let mut cookie = 0;
let mut message = None;
let mut level = super::DiagnosticLevel::Error;
@@ -157,7 +157,7 @@ unsafe fn unpackInlineAsm(di: &'ll DiagnosticInfo) -> Self {
}
}
unsafe fn unpackSrcMgr(di: &'ll DiagnosticInfo) -> Self {
unsafe fn unpackSrcMgr(di: &DiagnosticInfo) -> Self {
let mut cookie = 0;
let smdiag = SrcMgrDiagnostic::unpack(super::LLVMRustGetSMDiagnostic(di, &mut cookie));
InlineAsmDiagnostic {
@@ -180,7 +180,7 @@ pub enum Diagnostic<'ll> {
UnknownDiagnostic(&'ll DiagnosticInfo),
}
impl Diagnostic<'ll> {
impl<'ll> Diagnostic<'ll> {
pub unsafe fn unpack(di: &'ll DiagnosticInfo) -> Self {
use super::DiagnosticKind as Dk;
let kind = super::LLVMRustGetDiagInfoKind(di);
+199 -190
View File
@@ -1013,17 +1013,17 @@ pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
// Operations on function types
pub fn LLVMFunctionType(
pub fn LLVMFunctionType<'a>(
ReturnType: &'a Type,
ParamTypes: *const &'a Type,
ParamCount: c_uint,
IsVarArg: Bool,
) -> &'a Type;
pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
// Operations on struct types
pub fn LLVMStructTypeInContext(
pub fn LLVMStructTypeInContext<'a>(
C: &'a Context,
ElementTypes: *const &'a Type,
ElementCount: c_uint,
@@ -1046,10 +1046,10 @@ pub fn LLVMStructTypeInContext(
pub fn LLVMTypeOf(Val: &Value) -> &Type;
pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
pub fn LLVMGlobalSetMetadata(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
pub fn LLVMValueAsMetadata(Node: &'a Value) -> &Metadata;
pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
// Operations on constants of any type
pub fn LLVMConstNull(Ty: &Type) -> &Value;
@@ -1057,8 +1057,12 @@ pub fn LLVMStructTypeInContext(
// Operations on metadata
pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
pub fn LLVMMDNodeInContext<'a>(
C: &'a Context,
Vals: *const &'a Value,
Count: c_uint,
) -> &'a Value;
pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
// Operations on scalar constants
pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
@@ -1079,14 +1083,14 @@ pub fn LLVMConstStringInContext(
Length: c_uint,
DontNullTerminate: Bool,
) -> &Value;
pub fn LLVMConstStructInContext(
pub fn LLVMConstStructInContext<'a>(
C: &'a Context,
ConstantVals: *const &'a Value,
Count: c_uint,
Packed: Bool,
) -> &'a Value;
pub fn LLVMConstArray(
pub fn LLVMConstArray<'a>(
ElementTy: &'a Type,
ConstantVals: *const &'a Value,
Length: c_uint,
@@ -1094,17 +1098,17 @@ pub fn LLVMConstArray(
pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
// Constant expressions
pub fn LLVMRustConstInBoundsGEP2(
pub fn LLVMRustConstInBoundsGEP2<'a>(
ty: &'a Type,
ConstantVal: &'a Value,
ConstantIndices: *const &'a Value,
NumIndices: c_uint,
) -> &'a Value;
pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstExtractValue(
AggConstant: &Value,
IdxList: *const c_uint,
@@ -1125,20 +1129,20 @@ pub fn LLVMConstExtractValue(
// Operations on global variables
pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
pub fn LLVMRustGetOrInsertGlobal(
pub fn LLVMRustGetOrInsertGlobal<'a>(
M: &'a Module,
Name: *const c_char,
NameLen: size_t,
T: &'a Type,
) -> &'a Value;
pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
pub fn LLVMDeleteGlobal(GlobalVar: &Value);
pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
@@ -1152,7 +1156,7 @@ pub fn LLVMRustGetNamedValue(
pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
// Operations on functions
pub fn LLVMRustGetOrInsertFunction(
pub fn LLVMRustGetOrInsertFunction<'a>(
M: &'a Module,
Name: *const c_char,
NameLen: size_t,
@@ -1180,7 +1184,7 @@ pub fn LLVMRustAddFunctionAttrStringValue(
// Operations on basic blocks
pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
pub fn LLVMAppendBasicBlockInContext(
pub fn LLVMAppendBasicBlockInContext<'a>(
C: &'a Context,
Fn: &'a Value,
Name: *const c_char,
@@ -1204,7 +1208,7 @@ pub fn LLVMAppendBasicBlockInContext(
pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
// Operations on phi nodes
pub fn LLVMAddIncoming(
pub fn LLVMAddIncoming<'a>(
PhiNode: &'a Value,
IncomingValues: *const &'a Value,
IncomingBlocks: *const &'a BasicBlock,
@@ -1212,31 +1216,31 @@ pub fn LLVMAddIncoming(
);
// Instruction builders
pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
// Metadata
pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: &'a Value);
pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
// Terminators
pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
pub fn LLVMBuildCondBr(
pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
pub fn LLVMBuildCondBr<'a>(
B: &Builder<'a>,
If: &'a Value,
Then: &'a BasicBlock,
Else: &'a BasicBlock,
) -> &'a Value;
pub fn LLVMBuildSwitch(
pub fn LLVMBuildSwitch<'a>(
B: &Builder<'a>,
V: &'a Value,
Else: &'a BasicBlock,
NumCases: c_uint,
) -> &'a Value;
pub fn LLVMRustBuildInvoke(
pub fn LLVMRustBuildInvoke<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Fn: &'a Value,
@@ -1247,239 +1251,239 @@ pub fn LLVMRustBuildInvoke(
Bundle: Option<&OperandBundleDef<'a>>,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildLandingPad(
pub fn LLVMBuildLandingPad<'a>(
B: &Builder<'a>,
Ty: &'a Type,
PersFn: Option<&'a Value>,
NumClauses: c_uint,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
pub fn LLVMRustBuildCleanupPad(
pub fn LLVMRustBuildCleanupPad<'a>(
B: &Builder<'a>,
ParentPad: Option<&'a Value>,
ArgCnt: c_uint,
Args: *const &'a Value,
Name: *const c_char,
) -> Option<&'a Value>;
pub fn LLVMRustBuildCleanupRet(
pub fn LLVMRustBuildCleanupRet<'a>(
B: &Builder<'a>,
CleanupPad: &'a Value,
UnwindBB: Option<&'a BasicBlock>,
) -> Option<&'a Value>;
pub fn LLVMRustBuildCatchPad(
pub fn LLVMRustBuildCatchPad<'a>(
B: &Builder<'a>,
ParentPad: &'a Value,
ArgCnt: c_uint,
Args: *const &'a Value,
Name: *const c_char,
) -> Option<&'a Value>;
pub fn LLVMRustBuildCatchRet(
pub fn LLVMRustBuildCatchRet<'a>(
B: &Builder<'a>,
Pad: &'a Value,
BB: &'a BasicBlock,
) -> Option<&'a Value>;
pub fn LLVMRustBuildCatchSwitch(
pub fn LLVMRustBuildCatchSwitch<'a>(
Builder: &Builder<'a>,
ParentPad: Option<&'a Value>,
BB: Option<&'a BasicBlock>,
NumHandlers: c_uint,
Name: *const c_char,
) -> Option<&'a Value>;
pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
// Add a case to the switch instruction
pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
// Add a clause to the landing pad instruction
pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
// Set the cleanup on a landing pad instruction
pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
// Arithmetic
pub fn LLVMBuildAdd(
pub fn LLVMBuildAdd<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFAdd(
pub fn LLVMBuildFAdd<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildSub(
pub fn LLVMBuildSub<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFSub(
pub fn LLVMBuildFSub<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildMul(
pub fn LLVMBuildMul<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFMul(
pub fn LLVMBuildFMul<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildUDiv(
pub fn LLVMBuildUDiv<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildExactUDiv(
pub fn LLVMBuildExactUDiv<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildSDiv(
pub fn LLVMBuildSDiv<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildExactSDiv(
pub fn LLVMBuildExactSDiv<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFDiv(
pub fn LLVMBuildFDiv<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildURem(
pub fn LLVMBuildURem<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildSRem(
pub fn LLVMBuildSRem<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFRem(
pub fn LLVMBuildFRem<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildShl(
pub fn LLVMBuildShl<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildLShr(
pub fn LLVMBuildLShr<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildAShr(
pub fn LLVMBuildAShr<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNSWAdd(
pub fn LLVMBuildNSWAdd<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNUWAdd(
pub fn LLVMBuildNUWAdd<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNSWSub(
pub fn LLVMBuildNSWSub<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNUWSub(
pub fn LLVMBuildNUWSub<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNSWMul(
pub fn LLVMBuildNSWMul<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNUWMul(
pub fn LLVMBuildNUWMul<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildAnd(
pub fn LLVMBuildAnd<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildOr(
pub fn LLVMBuildOr<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildXor(
pub fn LLVMBuildXor<'a>(
B: &Builder<'a>,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMRustSetFastMath(Instr: &Value);
// Memory
pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildArrayAlloca(
pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildArrayAlloca<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Val: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildLoad2(
pub fn LLVMBuildLoad2<'a>(
B: &Builder<'a>,
Ty: &'a Type,
PointerVal: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
pub fn LLVMBuildGEP2(
pub fn LLVMBuildGEP2<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Pointer: &'a Value,
@@ -1487,7 +1491,7 @@ pub fn LLVMBuildGEP2(
NumIndices: c_uint,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildInBoundsGEP2(
pub fn LLVMBuildInBoundsGEP2<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Pointer: &'a Value,
@@ -1495,7 +1499,7 @@ pub fn LLVMBuildInBoundsGEP2(
NumIndices: c_uint,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildStructGEP2(
pub fn LLVMBuildStructGEP2<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Pointer: &'a Value,
@@ -1504,85 +1508,85 @@ pub fn LLVMBuildStructGEP2(
) -> &'a Value;
// Casts
pub fn LLVMBuildTrunc(
pub fn LLVMBuildTrunc<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildZExt(
pub fn LLVMBuildZExt<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildSExt(
pub fn LLVMBuildSExt<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFPToUI(
pub fn LLVMBuildFPToUI<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFPToSI(
pub fn LLVMBuildFPToSI<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildUIToFP(
pub fn LLVMBuildUIToFP<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildSIToFP(
pub fn LLVMBuildSIToFP<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFPTrunc(
pub fn LLVMBuildFPTrunc<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFPExt(
pub fn LLVMBuildFPExt<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildPtrToInt(
pub fn LLVMBuildPtrToInt<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildIntToPtr(
pub fn LLVMBuildIntToPtr<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildBitCast(
pub fn LLVMBuildBitCast<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildPointerCast(
pub fn LLVMBuildPointerCast<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMRustBuildIntCast(
pub fn LLVMRustBuildIntCast<'a>(
B: &Builder<'a>,
Val: &'a Value,
DestTy: &'a Type,
@@ -1590,14 +1594,14 @@ pub fn LLVMRustBuildIntCast(
) -> &'a Value;
// Comparisons
pub fn LLVMBuildICmp(
pub fn LLVMBuildICmp<'a>(
B: &Builder<'a>,
Op: c_uint,
LHS: &'a Value,
RHS: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildFCmp(
pub fn LLVMBuildFCmp<'a>(
B: &Builder<'a>,
Op: c_uint,
LHS: &'a Value,
@@ -1606,9 +1610,9 @@ pub fn LLVMBuildFCmp(
) -> &'a Value;
// Miscellaneous instructions
pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &'a Value;
pub fn LLVMRustBuildCall(
pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
pub fn LLVMRustBuildCall<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Fn: &'a Value,
@@ -1616,7 +1620,7 @@ pub fn LLVMRustBuildCall(
NumArgs: c_uint,
Bundle: Option<&OperandBundleDef<'a>>,
) -> &'a Value;
pub fn LLVMRustBuildMemCpy(
pub fn LLVMRustBuildMemCpy<'a>(
B: &Builder<'a>,
Dst: &'a Value,
DstAlign: c_uint,
@@ -1625,7 +1629,7 @@ pub fn LLVMRustBuildMemCpy(
Size: &'a Value,
IsVolatile: bool,
) -> &'a Value;
pub fn LLVMRustBuildMemMove(
pub fn LLVMRustBuildMemMove<'a>(
B: &Builder<'a>,
Dst: &'a Value,
DstAlign: c_uint,
@@ -1634,7 +1638,7 @@ pub fn LLVMRustBuildMemMove(
Size: &'a Value,
IsVolatile: bool,
) -> &'a Value;
pub fn LLVMRustBuildMemSet(
pub fn LLVMRustBuildMemSet<'a>(
B: &Builder<'a>,
Dst: &'a Value,
DstAlign: c_uint,
@@ -1642,46 +1646,46 @@ pub fn LLVMRustBuildMemSet(
Size: &'a Value,
IsVolatile: bool,
) -> &'a Value;
pub fn LLVMBuildSelect(
pub fn LLVMBuildSelect<'a>(
B: &Builder<'a>,
If: &'a Value,
Then: &'a Value,
Else: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildVAArg(
pub fn LLVMBuildVAArg<'a>(
B: &Builder<'a>,
list: &'a Value,
Ty: &'a Type,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildExtractElement(
pub fn LLVMBuildExtractElement<'a>(
B: &Builder<'a>,
VecVal: &'a Value,
Index: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildInsertElement(
pub fn LLVMBuildInsertElement<'a>(
B: &Builder<'a>,
VecVal: &'a Value,
EltVal: &'a Value,
Index: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildShuffleVector(
pub fn LLVMBuildShuffleVector<'a>(
B: &Builder<'a>,
V1: &'a Value,
V2: &'a Value,
Mask: &'a Value,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildExtractValue(
pub fn LLVMBuildExtractValue<'a>(
B: &Builder<'a>,
AggVal: &'a Value,
Index: c_uint,
Name: *const c_char,
) -> &'a Value;
pub fn LLVMBuildInsertValue(
pub fn LLVMBuildInsertValue<'a>(
B: &Builder<'a>,
AggVal: &'a Value,
EltVal: &'a Value,
@@ -1689,41 +1693,47 @@ pub fn LLVMBuildInsertValue(
Name: *const c_char,
) -> &'a Value;
pub fn LLVMRustBuildVectorReduceFAdd(
pub fn LLVMRustBuildVectorReduceFAdd<'a>(
B: &Builder<'a>,
Acc: &'a Value,
Src: &'a Value,
) -> &'a Value;
pub fn LLVMRustBuildVectorReduceFMul(
pub fn LLVMRustBuildVectorReduceFMul<'a>(
B: &Builder<'a>,
Acc: &'a Value,
Src: &'a Value,
) -> &'a Value;
pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceMin(
pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
pub fn LLVMRustBuildVectorReduceMin<'a>(
B: &Builder<'a>,
Src: &'a Value,
IsSigned: bool,
) -> &'a Value;
pub fn LLVMRustBuildVectorReduceMax(
pub fn LLVMRustBuildVectorReduceMax<'a>(
B: &Builder<'a>,
Src: &'a Value,
IsSigned: bool,
) -> &'a Value;
pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
-> &'a Value;
pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
-> &'a Value;
pub fn LLVMRustBuildVectorReduceFMin<'a>(
B: &Builder<'a>,
Src: &'a Value,
IsNaN: bool,
) -> &'a Value;
pub fn LLVMRustBuildVectorReduceFMax<'a>(
B: &Builder<'a>,
Src: &'a Value,
IsNaN: bool,
) -> &'a Value;
pub fn LLVMRustBuildMinNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
pub fn LLVMRustBuildMaxNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
// Atomic Operations
pub fn LLVMRustBuildAtomicLoad(
pub fn LLVMRustBuildAtomicLoad<'a>(
B: &Builder<'a>,
ElementType: &'a Type,
PointerVal: &'a Value,
@@ -1731,14 +1741,14 @@ pub fn LLVMRustBuildAtomicLoad(
Order: AtomicOrdering,
) -> &'a Value;
pub fn LLVMRustBuildAtomicStore(
pub fn LLVMRustBuildAtomicStore<'a>(
B: &Builder<'a>,
Val: &'a Value,
Ptr: &'a Value,
Order: AtomicOrdering,
) -> &'a Value;
pub fn LLVMRustBuildAtomicCmpXchg(
pub fn LLVMRustBuildAtomicCmpXchg<'a>(
B: &Builder<'a>,
LHS: &'a Value,
CMP: &'a Value,
@@ -1748,7 +1758,7 @@ pub fn LLVMRustBuildAtomicCmpXchg(
Weak: Bool,
) -> &'a Value;
pub fn LLVMBuildAtomicRMW(
pub fn LLVMBuildAtomicRMW<'a>(
B: &Builder<'a>,
Op: AtomicRmwBinOp,
LHS: &'a Value,
@@ -1767,16 +1777,16 @@ pub fn LLVMRustBuildAtomicFence(
pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
/// Creates a pass manager.
pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
/// Creates a function-by-function pass manager
pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
/// Disposes a pass manager.
pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
/// Runs a pass manager on a module.
pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
pub fn LLVMInitializePasses();
@@ -1786,7 +1796,7 @@ pub fn LLVMRustBuildAtomicFence(
pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
pub fn LLVMAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>);
pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
@@ -1830,7 +1840,7 @@ pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
pub fn LLVMStructSetBody(
pub fn LLVMStructSetBody<'a>(
StructTy: &'a Type,
ElementTypes: *const &'a Type,
ElementCount: c_uint,
@@ -1873,8 +1883,7 @@ pub fn LLVMRustCoverageWriteMappingToBuffer(
BufferOut: &RustString,
);
pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &'a Value, FuncName: *const c_char)
-> &'a Value;
pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
@@ -1895,15 +1904,15 @@ pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &'a Value, FuncName: *const c_cha
pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
pub fn LLVMRustDIBuilderCreateCompileUnit(
pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
Builder: &DIBuilder<'a>,
Lang: c_uint,
File: &'a DIFile,
@@ -1919,7 +1928,7 @@ pub fn LLVMRustDIBuilderCreateCompileUnit(
SplitDebugInlining: bool,
) -> &'a DIDescriptor;
pub fn LLVMRustDIBuilderCreateFile(
pub fn LLVMRustDIBuilderCreateFile<'a>(
Builder: &DIBuilder<'a>,
Filename: *const c_char,
FilenameLen: size_t,
@@ -1930,12 +1939,12 @@ pub fn LLVMRustDIBuilderCreateFile(
ChecksumLen: size_t,
) -> &'a DIFile;
pub fn LLVMRustDIBuilderCreateSubroutineType(
pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
Builder: &DIBuilder<'a>,
ParameterTypes: &'a DIArray,
) -> &'a DICompositeType;
pub fn LLVMRustDIBuilderCreateFunction(
pub fn LLVMRustDIBuilderCreateFunction<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIDescriptor,
Name: *const c_char,
@@ -1953,7 +1962,7 @@ pub fn LLVMRustDIBuilderCreateFunction(
Decl: Option<&'a DIDescriptor>,
) -> &'a DISubprogram;
pub fn LLVMRustDIBuilderCreateBasicType(
pub fn LLVMRustDIBuilderCreateBasicType<'a>(
Builder: &DIBuilder<'a>,
Name: *const c_char,
NameLen: size_t,
@@ -1961,7 +1970,7 @@ pub fn LLVMRustDIBuilderCreateBasicType(
Encoding: c_uint,
) -> &'a DIBasicType;
pub fn LLVMRustDIBuilderCreateTypedef(
pub fn LLVMRustDIBuilderCreateTypedef<'a>(
Builder: &DIBuilder<'a>,
Type: &'a DIBasicType,
Name: *const c_char,
@@ -1971,7 +1980,7 @@ pub fn LLVMRustDIBuilderCreateTypedef(
Scope: Option<&'a DIScope>,
) -> &'a DIDerivedType;
pub fn LLVMRustDIBuilderCreatePointerType(
pub fn LLVMRustDIBuilderCreatePointerType<'a>(
Builder: &DIBuilder<'a>,
PointeeTy: &'a DIType,
SizeInBits: u64,
@@ -1981,7 +1990,7 @@ pub fn LLVMRustDIBuilderCreatePointerType(
NameLen: size_t,
) -> &'a DIDerivedType;
pub fn LLVMRustDIBuilderCreateStructType(
pub fn LLVMRustDIBuilderCreateStructType<'a>(
Builder: &DIBuilder<'a>,
Scope: Option<&'a DIDescriptor>,
Name: *const c_char,
@@ -1999,7 +2008,7 @@ pub fn LLVMRustDIBuilderCreateStructType(
UniqueIdLen: size_t,
) -> &'a DICompositeType;
pub fn LLVMRustDIBuilderCreateMemberType(
pub fn LLVMRustDIBuilderCreateMemberType<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIDescriptor,
Name: *const c_char,
@@ -2013,7 +2022,7 @@ pub fn LLVMRustDIBuilderCreateMemberType(
Ty: &'a DIType,
) -> &'a DIDerivedType;
pub fn LLVMRustDIBuilderCreateVariantMemberType(
pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIScope,
Name: *const c_char,
@@ -2028,7 +2037,7 @@ pub fn LLVMRustDIBuilderCreateVariantMemberType(
Ty: &'a DIType,
) -> &'a DIType;
pub fn LLVMRustDIBuilderCreateLexicalBlock(
pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIScope,
File: &'a DIFile,
@@ -2036,13 +2045,13 @@ pub fn LLVMRustDIBuilderCreateLexicalBlock(
Col: c_uint,
) -> &'a DILexicalBlock;
pub fn LLVMRustDIBuilderCreateLexicalBlockFile(
pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIScope,
File: &'a DIFile,
) -> &'a DILexicalBlock;
pub fn LLVMRustDIBuilderCreateStaticVariable(
pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
Builder: &DIBuilder<'a>,
Context: Option<&'a DIScope>,
Name: *const c_char,
@@ -2058,7 +2067,7 @@ pub fn LLVMRustDIBuilderCreateStaticVariable(
AlignInBits: u32,
) -> &'a DIGlobalVariableExpression;
pub fn LLVMRustDIBuilderCreateVariable(
pub fn LLVMRustDIBuilderCreateVariable<'a>(
Builder: &DIBuilder<'a>,
Tag: c_uint,
Scope: &'a DIDescriptor,
@@ -2073,7 +2082,7 @@ pub fn LLVMRustDIBuilderCreateVariable(
AlignInBits: u32,
) -> &'a DIVariable;
pub fn LLVMRustDIBuilderCreateArrayType(
pub fn LLVMRustDIBuilderCreateArrayType<'a>(
Builder: &DIBuilder<'a>,
Size: u64,
AlignInBits: u32,
@@ -2081,19 +2090,19 @@ pub fn LLVMRustDIBuilderCreateArrayType(
Subscripts: &'a DIArray,
) -> &'a DIType;
pub fn LLVMRustDIBuilderGetOrCreateSubrange(
pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
Builder: &DIBuilder<'a>,
Lo: i64,
Count: i64,
) -> &'a DISubrange;
pub fn LLVMRustDIBuilderGetOrCreateArray(
pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
Builder: &DIBuilder<'a>,
Ptr: *const Option<&'a DIDescriptor>,
Count: c_uint,
) -> &'a DIArray;
pub fn LLVMRustDIBuilderInsertDeclareAtEnd(
pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
Builder: &DIBuilder<'a>,
Val: &'a Value,
VarInfo: &'a DIVariable,
@@ -2103,7 +2112,7 @@ pub fn LLVMRustDIBuilderInsertDeclareAtEnd(
InsertAtEnd: &'a BasicBlock,
) -> &'a Value;
pub fn LLVMRustDIBuilderCreateEnumerator(
pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
Builder: &DIBuilder<'a>,
Name: *const c_char,
NameLen: size_t,
@@ -2111,7 +2120,7 @@ pub fn LLVMRustDIBuilderCreateEnumerator(
IsUnsigned: bool,
) -> &'a DIEnumerator;
pub fn LLVMRustDIBuilderCreateEnumerationType(
pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIScope,
Name: *const c_char,
@@ -2125,7 +2134,7 @@ pub fn LLVMRustDIBuilderCreateEnumerationType(
IsScoped: bool,
) -> &'a DIType;
pub fn LLVMRustDIBuilderCreateUnionType(
pub fn LLVMRustDIBuilderCreateUnionType<'a>(
Builder: &DIBuilder<'a>,
Scope: Option<&'a DIScope>,
Name: *const c_char,
@@ -2141,7 +2150,7 @@ pub fn LLVMRustDIBuilderCreateUnionType(
UniqueIdLen: size_t,
) -> &'a DIType;
pub fn LLVMRustDIBuilderCreateVariantPart(
pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
Builder: &DIBuilder<'a>,
Scope: &'a DIScope,
Name: *const c_char,
@@ -2159,7 +2168,7 @@ pub fn LLVMRustDIBuilderCreateVariantPart(
pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
Builder: &DIBuilder<'a>,
Scope: Option<&'a DIScope>,
Name: *const c_char,
@@ -2167,7 +2176,7 @@ pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
Ty: &'a DIType,
) -> &'a DITemplateTypeParameter;
pub fn LLVMRustDIBuilderCreateNameSpace(
pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
Builder: &DIBuilder<'a>,
Scope: Option<&'a DIScope>,
Name: *const c_char,
@@ -2175,14 +2184,14 @@ pub fn LLVMRustDIBuilderCreateNameSpace(
ExportSymbols: bool,
) -> &'a DINameSpace;
pub fn LLVMRustDICompositeTypeReplaceArrays(
pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
Builder: &DIBuilder<'a>,
CompositeType: &'a DIType,
Elements: Option<&'a DIArray>,
Params: Option<&'a DIArray>,
);
pub fn LLVMRustDIBuilderCreateDebugLocation(
pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
Line: c_uint,
Column: c_uint,
Scope: &'a DIScope,
@@ -2248,7 +2257,7 @@ pub fn LLVMRustCreateTargetMachine(
SplitDwarfFile: *const c_char,
) -> Option<&'static mut TargetMachine>;
pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
pub fn LLVMRustAddBuilderLibraryInfo(
pub fn LLVMRustAddBuilderLibraryInfo<'a>(
PMB: &'a PassManagerBuilder,
M: &'a Module,
DisableSimplifyLibCalls: bool,
@@ -2264,13 +2273,13 @@ pub fn LLVMRustConfigurePassManagerBuilder(
PGOUsePath: *const c_char,
PGOSampleUsePath: *const c_char,
);
pub fn LLVMRustAddLibraryInfo(
pub fn LLVMRustAddLibraryInfo<'a>(
PM: &PassManager<'a>,
M: &'a Module,
DisableSimplifyLibCalls: bool,
);
pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
pub fn LLVMRustWriteOutputFile(
pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
pub fn LLVMRustWriteOutputFile<'a>(
T: &'a TargetMachine,
PM: &PassManager<'a>,
M: &'a Module,
@@ -2278,7 +2287,7 @@ pub fn LLVMRustWriteOutputFile(
DwoOutput: *const c_char,
FileType: FileType,
) -> LLVMRustResult;
pub fn LLVMRustOptimizeWithNewPassManager(
pub fn LLVMRustOptimizeWithNewPassManager<'a>(
M: &'a Module,
TM: &'a TargetMachine,
OptLevel: PassBuilderOptLevel,
@@ -2306,7 +2315,7 @@ pub fn LLVMRustOptimizeWithNewPassManager(
ExtraPassesLen: size_t,
) -> LLVMRustResult;
pub fn LLVMRustPrintModule(
M: &'a Module,
M: &Module,
Output: *const c_char,
Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
) -> LLVMRustResult;
@@ -2319,21 +2328,21 @@ pub fn LLVMRustPrintModule(
pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
pub fn LLVMRustArchiveIteratorNext(
pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
pub fn LLVMRustArchiveIteratorNext<'a>(
AIR: &ArchiveIterator<'a>,
) -> Option<&'a mut ArchiveChild<'a>>;
pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
#[allow(improper_ctypes)]
pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
#[allow(improper_ctypes)]
pub fn LLVMRustUnpackOptimizationDiagnostic(
pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
DI: &'a DiagnosticInfo,
pass_name_out: &RustString,
function_out: &mut Option<&'a Value>,
@@ -2343,7 +2352,7 @@ pub fn LLVMRustUnpackOptimizationDiagnostic(
message_out: &RustString,
);
pub fn LLVMRustUnpackInlineAsmDiagnostic(
pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
DI: &'a DiagnosticInfo,
level_out: &mut DiagnosticLevel,
cookie_out: &mut c_uint,
@@ -2354,7 +2363,7 @@ pub fn LLVMRustUnpackInlineAsmDiagnostic(
pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
pub fn LLVMRustGetSMDiagnostic(
pub fn LLVMRustGetSMDiagnostic<'a>(
DI: &'a DiagnosticInfo,
cookie_out: &mut c_uint,
) -> &'a SMDiagnostic;
@@ -2383,12 +2392,12 @@ pub fn LLVMRustWriteArchive(
WriteSymbtab: bool,
Kind: ArchiveKind,
) -> LLVMRustResult;
pub fn LLVMRustArchiveMemberNew(
pub fn LLVMRustArchiveMemberNew<'a>(
Filename: *const c_char,
Name: *const c_char,
Child: Option<&ArchiveChild<'a>>,
) -> &'a mut RustArchiveMember<'a>;
pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
pub fn LLVMRustWriteImportLibrary(
ImportName: *const c_char,
@@ -2399,18 +2408,18 @@ pub fn LLVMRustWriteImportLibrary(
MinGW: bool,
) -> LLVMRustResult;
pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
pub fn LLVMRustBuildOperandBundleDef(
pub fn LLVMRustBuildOperandBundleDef<'a>(
Name: *const c_char,
Inputs: *const &'a Value,
NumInputs: c_uint,
) -> &'a mut OperandBundleDef<'a>;
pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
pub fn LLVMRustUnsetComdat(V: &Value);
pub fn LLVMRustSetModulePICLevel(M: &Module);
pub fn LLVMRustSetModulePIELevel(M: &Module);
@@ -2463,13 +2472,13 @@ pub fn LLVMRustGetBitcodeSliceFromObjectData(
pub fn LLVMRustLTOGetDICompileUnit(M: &Module, CU1: &mut *mut c_void, CU2: &mut *mut c_void);
pub fn LLVMRustLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
pub fn LLVMRustLinkerAdd(
linker: &Linker<'_>,
bytecode: *const c_char,
bytecode_len: usize,
) -> bool;
pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);
pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
#[allow(improper_ctypes)]
pub fn LLVMRustComputeLTOCacheKey(
key_out: &RustString,
+10 -10
View File
@@ -31,13 +31,13 @@ pub fn into_result(self) -> Result<(), ()> {
}
}
pub fn AddFunctionAttrStringValue(llfn: &'a Value, idx: AttributePlace, attr: &CStr, value: &CStr) {
pub fn AddFunctionAttrStringValue(llfn: &Value, idx: AttributePlace, attr: &CStr, value: &CStr) {
unsafe {
LLVMRustAddFunctionAttrStringValue(llfn, idx.as_uint(), attr.as_ptr(), value.as_ptr())
}
}
pub fn AddFunctionAttrString(llfn: &'a Value, idx: AttributePlace, attr: &CStr) {
pub fn AddFunctionAttrString(llfn: &Value, idx: AttributePlace, attr: &CStr) {
unsafe {
LLVMRustAddFunctionAttrStringValue(llfn, idx.as_uint(), attr.as_ptr(), std::ptr::null())
}
@@ -86,12 +86,12 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
}
}
pub fn SetInstructionCallConv(instr: &'a Value, cc: CallConv) {
pub fn SetInstructionCallConv(instr: &Value, cc: CallConv) {
unsafe {
LLVMSetInstructionCallConv(instr, cc as c_uint);
}
}
pub fn SetFunctionCallConv(fn_: &'a Value, cc: CallConv) {
pub fn SetFunctionCallConv(fn_: &Value, cc: CallConv) {
unsafe {
LLVMSetFunctionCallConv(fn_, cc as c_uint);
}
@@ -103,26 +103,26 @@ pub fn SetFunctionCallConv(fn_: &'a Value, cc: CallConv) {
// value's name as the comdat value to make sure that it is in a 1-to-1 relationship to the
// function.
// For more details on COMDAT sections see e.g., https://www.airs.com/blog/archives/52
pub fn SetUniqueComdat(llmod: &Module, val: &'a Value) {
pub fn SetUniqueComdat(llmod: &Module, val: &Value) {
unsafe {
let name = get_value_name(val);
LLVMRustSetComdat(llmod, val, name.as_ptr().cast(), name.len());
}
}
pub fn UnsetComdat(val: &'a Value) {
pub fn UnsetComdat(val: &Value) {
unsafe {
LLVMRustUnsetComdat(val);
}
}
pub fn SetUnnamedAddress(global: &'a Value, unnamed: UnnamedAddr) {
pub fn SetUnnamedAddress(global: &Value, unnamed: UnnamedAddr) {
unsafe {
LLVMSetUnnamedAddress(global, unnamed);
}
}
pub fn set_thread_local_mode(global: &'a Value, mode: ThreadLocalMode) {
pub fn set_thread_local_mode(global: &Value, mode: ThreadLocalMode) {
unsafe {
LLVMSetThreadLocalMode(global, mode);
}
@@ -264,7 +264,7 @@ pub struct OperandBundleDef<'a> {
pub raw: &'a mut ffi::OperandBundleDef<'a>,
}
impl OperandBundleDef<'a> {
impl<'a> OperandBundleDef<'a> {
pub fn new(name: &str, vals: &[&'a Value]) -> Self {
let name = SmallCStr::new(name);
let def = unsafe {
@@ -274,7 +274,7 @@ pub fn new(name: &str, vals: &[&'a Value]) -> Self {
}
}
impl Drop for OperandBundleDef<'a> {
impl Drop for OperandBundleDef<'_> {
fn drop(&mut self) {
unsafe {
LLVMRustFreeOperandBundleDef(&mut *(self.raw as *mut _));
+2 -2
View File
@@ -13,7 +13,7 @@
use rustc_target::spec::RelocModel;
use tracing::debug;
impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'tcx> PreDefineMethods<'tcx> for CodegenCx<'_, 'tcx> {
fn predefine_static(
&self,
def_id: DefId,
@@ -92,7 +92,7 @@ fn predefine_fn(
}
}
impl CodegenCx<'ll, 'tcx> {
impl CodegenCx<'_, '_> {
/// Whether a definition or declaration can be assumed to be local to a group of
/// libraries that form a single DSO or executable.
pub(crate) unsafe fn should_assume_dso_local(
+3 -3
View File
@@ -38,7 +38,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
impl CodegenCx<'ll, 'tcx> {
impl<'ll> CodegenCx<'ll, '_> {
crate fn type_named_struct(&self, name: &str) -> &'ll Type {
let name = SmallCStr::new(name);
unsafe { llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr()) }
@@ -133,7 +133,7 @@ impl CodegenCx<'ll, 'tcx> {
}
}
impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn type_i1(&self) -> &'ll Type {
unsafe { llvm::LLVMInt1TypeInContext(self.llcx) }
}
@@ -252,7 +252,7 @@ fn ptr_to(&self, address_space: AddressSpace) -> &Type {
}
}
impl LayoutTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
impl<'ll, 'tcx> LayoutTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn backend_type(&self, layout: TyAndLayout<'tcx>) -> &'ll Type {
layout.llvm_type(self)
}
+10 -10
View File
@@ -11,8 +11,8 @@
use rustc_middle::ty::Ty;
use rustc_target::abi::{Align, Endian, HasDataLayout, Size};
fn round_pointer_up_to_alignment(
bx: &mut Builder<'a, 'll, 'tcx>,
fn round_pointer_up_to_alignment<'ll>(
bx: &mut Builder<'_, 'll, '_>,
addr: &'ll Value,
align: Align,
ptr_ty: &'ll Type,
@@ -23,8 +23,8 @@ fn round_pointer_up_to_alignment(
bx.inttoptr(ptr_as_int, ptr_ty)
}
fn emit_direct_ptr_va_arg(
bx: &mut Builder<'a, 'll, 'tcx>,
fn emit_direct_ptr_va_arg<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
list: OperandRef<'tcx, &'ll Value>,
llty: &'ll Type,
size: Size,
@@ -62,8 +62,8 @@ fn emit_direct_ptr_va_arg(
}
}
fn emit_ptr_va_arg(
bx: &mut Builder<'a, 'll, 'tcx>,
fn emit_ptr_va_arg<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
list: OperandRef<'tcx, &'ll Value>,
target_ty: Ty<'tcx>,
indirect: bool,
@@ -90,8 +90,8 @@ fn emit_ptr_va_arg(
}
}
fn emit_aapcs_va_arg(
bx: &mut Builder<'a, 'll, 'tcx>,
fn emit_aapcs_va_arg<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
list: OperandRef<'tcx, &'ll Value>,
target_ty: Ty<'tcx>,
) -> &'ll Value {
@@ -175,8 +175,8 @@ fn emit_aapcs_va_arg(
val
}
pub(super) fn emit_va_arg(
bx: &mut Builder<'a, 'll, 'tcx>,
pub(super) fn emit_va_arg<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
addr: OperandRef<'tcx, &'ll Value>,
target_ty: Ty<'tcx>,
) -> &'ll Value {