Skip to main content

rustc_codegen_llvm/llvm/
ffi.rs

1//! Bindings to the LLVM-C API (`LLVM*`), and to our own `extern "C"` wrapper
2//! functions around the unstable LLVM C++ API (`LLVMRust*`).
3//!
4//! ## Passing pointer/length strings as `*const c_uchar` (PTR_LEN_STR)
5//!
6//! Normally it's a good idea for Rust-side bindings to match the corresponding
7//! C-side function declarations as closely as possible. But when passing `&str`
8//! or `&[u8]` data as a pointer/length pair, it's more convenient to declare
9//! the Rust-side pointer as `*const c_uchar` instead of `*const c_char`.
10//! Both pointer types have the same ABI, and using `*const c_uchar` avoids
11//! the need for an extra cast from `*const u8` on the Rust side.
12
13#![allow(non_camel_case_types)]
14
15use std::fmt::{self, Debug};
16use std::marker::PhantomData;
17use std::num::NonZero;
18use std::ptr;
19
20use bitflags::bitflags;
21use libc::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_void, size_t};
22
23use super::RustString;
24use super::debuginfo::{
25    DIArray, DIBuilder, DIDerivedType, DIDescriptor, DIFile, DIFlags, DILocation, DISPFlags,
26    DIScope, DISubprogram, DITemplateTypeParameter, DIType, DebugEmissionKind, DebugNameTableKind,
27};
28use crate::llvm::MetadataKindId;
29use crate::{TryFromU32, llvm};
30
31/// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
32/// which has a different ABI from Rust or C++ `bool`.
33///
34/// This wrapper does not implement `PartialEq`.
35/// To test the underlying boolean value, use [`Self::is_true`].
36#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Bool { }
#[automatically_derived]
impl ::core::clone::Clone for Bool {
    #[inline]
    fn clone(&self) -> Bool {
        let _: ::core::clone::AssertParamIsClone<c_int>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Bool { }Copy)]
37#[repr(transparent)]
38pub(crate) struct Bool {
39    value: c_int,
40}
41
42pub(crate) const TRUE: Bool = Bool::TRUE;
43pub(crate) const FALSE: Bool = Bool::FALSE;
44
45impl Bool {
46    pub(crate) const TRUE: Self = Self { value: 1 };
47    pub(crate) const FALSE: Self = Self { value: 0 };
48
49    pub(crate) const fn from_bool(rust_bool: bool) -> Self {
50        if rust_bool { Self::TRUE } else { Self::FALSE }
51    }
52
53    /// Converts this LLVM-C boolean to a Rust `bool`
54    pub(crate) fn is_true(self) -> bool {
55        // Since we're interacting with a C API, follow the C convention of
56        // treating any nonzero value as true.
57        self.value != Self::FALSE.value
58    }
59}
60
61impl Debug for Bool {
62    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
63        match self.value {
64            0 => f.write_str("FALSE"),
65            1 => f.write_str("TRUE"),
66            // As with `Self::is_true`, treat any nonzero value as true.
67            v => f.write_fmt(format_args!("TRUE ({0})", v))write!(f, "TRUE ({v})"),
68        }
69    }
70}
71
72/// Convenience trait to convert `bool` to `llvm::Bool` with an explicit method call.
73///
74/// Being able to write `b.to_llvm_bool()` is less noisy than `llvm::Bool::from(b)`,
75/// while being more explicit and less mistake-prone than something like `b.into()`.
76pub(crate) trait ToLlvmBool: Copy {
77    fn to_llvm_bool(self) -> llvm::Bool;
78}
79
80impl ToLlvmBool for bool {
81    #[inline(always)]
82    fn to_llvm_bool(self) -> llvm::Bool {
83        llvm::Bool::from_bool(self)
84    }
85}
86
87/// Wrapper for a raw enum value returned from LLVM's C APIs.
88///
89/// For C enums returned by LLVM, it's risky to use a Rust enum as the return
90/// type, because it would be UB if a later version of LLVM adds a new enum
91/// value and returns it. Instead, return this raw wrapper, then convert to the
92/// Rust-side enum explicitly.
93#[repr(transparent)]
94pub(crate) struct RawEnum<T> {
95    value: u32,
96    /// We don't own or consume a `T`, but we can produce one.
97    _rust_side_type: PhantomData<fn() -> T>,
98}
99
100impl<T: TryFrom<u32>> RawEnum<T> {
101    #[track_caller]
102    pub(crate) fn to_rust(self) -> T
103    where
104        T::Error: Debug,
105    {
106        // If this fails, the Rust-side enum is out of sync with LLVM's enum.
107        T::try_from(self.value).expect("enum value returned by LLVM should be known")
108    }
109}
110
111#[derive(#[automatically_derived]
#[allow(dead_code)]
impl ::core::marker::Copy for LLVMRustResult { }Copy, #[automatically_derived]
#[doc(hidden)]
#[allow(dead_code)]
unsafe impl ::core::clone::TrivialClone for LLVMRustResult { }
#[automatically_derived]
#[allow(dead_code)]
impl ::core::clone::Clone for LLVMRustResult {
    #[inline]
    fn clone(&self) -> LLVMRustResult { *self }
}Clone, #[automatically_derived]
#[allow(dead_code)]
impl ::core::marker::StructuralPartialEq for LLVMRustResult { }
#[automatically_derived]
#[allow(dead_code)]
impl ::core::cmp::PartialEq for LLVMRustResult {
    #[inline]
    fn eq(&self, other: &LLVMRustResult) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
112#[repr(C)]
113#[allow(dead_code)] // Variants constructed by C++.
114pub(crate) enum LLVMRustResult {
115    Success,
116    Failure,
117}
118
119/// Must match the layout of `LLVMRustModuleFlagMergeBehavior`.
120///
121/// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are
122/// resolved according to the merge behaviors specified here. Flags differing only in merge
123/// behavior are still considered to be in conflict.
124///
125/// In order for Rust-C LTO to work, we must specify behaviors compatible with Clang. Notably,
126/// 'Error' and 'Warning' cannot be mixed for a given flag.
127///
128/// There is a stable LLVM-C version of this enum (`LLVMModuleFlagBehavior`),
129/// but as of LLVM 19 it does not support all of the enum values in the unstable
130/// C++ API.
131#[derive(#[automatically_derived]
impl ::core::marker::Copy for ModuleFlagMergeBehavior { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ModuleFlagMergeBehavior { }
#[automatically_derived]
impl ::core::clone::Clone for ModuleFlagMergeBehavior {
    #[inline]
    fn clone(&self) -> ModuleFlagMergeBehavior { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for ModuleFlagMergeBehavior { }
#[automatically_derived]
impl ::core::cmp::PartialEq for ModuleFlagMergeBehavior {
    #[inline]
    fn eq(&self, other: &ModuleFlagMergeBehavior) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
132#[repr(C)]
133pub(crate) enum ModuleFlagMergeBehavior {
134    Error = 1,
135    Warning = 2,
136    Require = 3,
137    Override = 4,
138    Append = 5,
139    AppendUnique = 6,
140    Max = 7,
141    Min = 8,
142}
143
144// Consts for the LLVM CallConv type, pre-cast to usize.
145
146/// Must match the layout of `LLVMTailCallKind`.
147#[derive(#[automatically_derived]
#[allow(dead_code)]
impl ::core::marker::Copy for TailCallKind { }Copy, #[automatically_derived]
#[doc(hidden)]
#[allow(dead_code)]
unsafe impl ::core::clone::TrivialClone for TailCallKind { }
#[automatically_derived]
#[allow(dead_code)]
impl ::core::clone::Clone for TailCallKind {
    #[inline]
    fn clone(&self) -> TailCallKind { *self }
}Clone, #[automatically_derived]
#[allow(dead_code)]
impl ::core::marker::StructuralPartialEq for TailCallKind { }
#[automatically_derived]
#[allow(dead_code)]
impl ::core::cmp::PartialEq for TailCallKind {
    #[inline]
    fn eq(&self, other: &TailCallKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
#[allow(dead_code)]
impl ::core::fmt::Debug for TailCallKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                TailCallKind::None => "None",
                TailCallKind::Tail => "Tail",
                TailCallKind::MustTail => "MustTail",
                TailCallKind::NoTail => "NoTail",
            })
    }
}Debug)]
148#[repr(C)]
149#[allow(dead_code)]
150pub(crate) enum TailCallKind {
151    None = 0,
152    Tail = 1,
153    MustTail = 2,
154    NoTail = 3,
155}
156
157/// LLVM CallingConv::ID. Should we wrap this?
158///
159/// See <https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/CallingConv.h>
160#[derive(#[automatically_derived]
impl ::core::marker::Copy for CallConv { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CallConv { }
#[automatically_derived]
impl ::core::clone::Clone for CallConv {
    #[inline]
    fn clone(&self) -> CallConv { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CallConv { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CallConv {
    #[inline]
    fn eq(&self, other: &CallConv) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for CallConv {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CallConv::CCallConv => "CCallConv",
                CallConv::FastCallConv => "FastCallConv",
                CallConv::ColdCallConv => "ColdCallConv",
                CallConv::PreserveMost => "PreserveMost",
                CallConv::PreserveAll => "PreserveAll",
                CallConv::SwiftCallConv => "SwiftCallConv",
                CallConv::Tail => "Tail",
                CallConv::PreserveNone => "PreserveNone",
                CallConv::X86StdcallCallConv => "X86StdcallCallConv",
                CallConv::X86FastcallCallConv => "X86FastcallCallConv",
                CallConv::ArmAapcsCallConv => "ArmAapcsCallConv",
                CallConv::Msp430Intr => "Msp430Intr",
                CallConv::X86_ThisCall => "X86_ThisCall",
                CallConv::PtxKernel => "PtxKernel",
                CallConv::X86_64_SysV => "X86_64_SysV",
                CallConv::X86_64_Win64 => "X86_64_Win64",
                CallConv::X86_VectorCall => "X86_VectorCall",
                CallConv::X86_Intr => "X86_Intr",
                CallConv::AvrNonBlockingInterrupt =>
                    "AvrNonBlockingInterrupt",
                CallConv::AvrInterrupt => "AvrInterrupt",
                CallConv::AmdgpuKernel => "AmdgpuKernel",
            })
    }
}Debug, impl ::core::convert::TryFrom<u32> for CallConv {
    type Error = u32;
    #[allow(deprecated)]
    fn try_from(value: u32) -> ::core::result::Result<CallConv, Self::Error> {
        if value == const { CallConv::CCallConv as u32 } {
            return Ok(CallConv::CCallConv)
        }
        if value == const { CallConv::FastCallConv as u32 } {
            return Ok(CallConv::FastCallConv)
        }
        if value == const { CallConv::ColdCallConv as u32 } {
            return Ok(CallConv::ColdCallConv)
        }
        if value == const { CallConv::PreserveMost as u32 } {
            return Ok(CallConv::PreserveMost)
        }
        if value == const { CallConv::PreserveAll as u32 } {
            return Ok(CallConv::PreserveAll)
        }
        if value == const { CallConv::SwiftCallConv as u32 } {
            return Ok(CallConv::SwiftCallConv)
        }
        if value == const { CallConv::Tail as u32 } {
            return Ok(CallConv::Tail)
        }
        if value == const { CallConv::PreserveNone as u32 } {
            return Ok(CallConv::PreserveNone)
        }
        if value == const { CallConv::X86StdcallCallConv as u32 } {
            return Ok(CallConv::X86StdcallCallConv)
        }
        if value == const { CallConv::X86FastcallCallConv as u32 } {
            return Ok(CallConv::X86FastcallCallConv)
        }
        if value == const { CallConv::ArmAapcsCallConv as u32 } {
            return Ok(CallConv::ArmAapcsCallConv)
        }
        if value == const { CallConv::Msp430Intr as u32 } {
            return Ok(CallConv::Msp430Intr)
        }
        if value == const { CallConv::X86_ThisCall as u32 } {
            return Ok(CallConv::X86_ThisCall)
        }
        if value == const { CallConv::PtxKernel as u32 } {
            return Ok(CallConv::PtxKernel)
        }
        if value == const { CallConv::X86_64_SysV as u32 } {
            return Ok(CallConv::X86_64_SysV)
        }
        if value == const { CallConv::X86_64_Win64 as u32 } {
            return Ok(CallConv::X86_64_Win64)
        }
        if value == const { CallConv::X86_VectorCall as u32 } {
            return Ok(CallConv::X86_VectorCall)
        }
        if value == const { CallConv::X86_Intr as u32 } {
            return Ok(CallConv::X86_Intr)
        }
        if value == const { CallConv::AvrNonBlockingInterrupt as u32 } {
            return Ok(CallConv::AvrNonBlockingInterrupt)
        }
        if value == const { CallConv::AvrInterrupt as u32 } {
            return Ok(CallConv::AvrInterrupt)
        }
        if value == const { CallConv::AmdgpuKernel as u32 } {
            return Ok(CallConv::AmdgpuKernel)
        }
        Err(value)
    }
}TryFromU32)]
161#[repr(C)]
162pub(crate) enum CallConv {
163    CCallConv = 0,
164    FastCallConv = 8,
165    ColdCallConv = 9,
166    PreserveMost = 14,
167    PreserveAll = 15,
168    SwiftCallConv = 16,
169    Tail = 18,
170    PreserveNone = 21,
171    X86StdcallCallConv = 64,
172    X86FastcallCallConv = 65,
173    ArmAapcsCallConv = 67,
174    Msp430Intr = 69,
175    X86_ThisCall = 70,
176    PtxKernel = 71,
177    X86_64_SysV = 78,
178    X86_64_Win64 = 79,
179    X86_VectorCall = 80,
180    X86_Intr = 83,
181    AvrNonBlockingInterrupt = 84,
182    AvrInterrupt = 85,
183    AmdgpuKernel = 91,
184}
185
186/// Must match the layout of `LLVMLinkage`.
187#[derive(#[automatically_derived]
impl ::core::marker::Copy for Linkage { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Linkage { }
#[automatically_derived]
impl ::core::clone::Clone for Linkage {
    #[inline]
    fn clone(&self) -> Linkage { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Linkage { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Linkage {
    #[inline]
    fn eq(&self, other: &Linkage) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, impl ::core::convert::TryFrom<u32> for Linkage {
    type Error = u32;
    #[allow(deprecated)]
    fn try_from(value: u32) -> ::core::result::Result<Linkage, Self::Error> {
        if value == const { Linkage::ExternalLinkage as u32 } {
            return Ok(Linkage::ExternalLinkage)
        }
        if value == const { Linkage::AvailableExternallyLinkage as u32 } {
            return Ok(Linkage::AvailableExternallyLinkage)
        }
        if value == const { Linkage::LinkOnceAnyLinkage as u32 } {
            return Ok(Linkage::LinkOnceAnyLinkage)
        }
        if value == const { Linkage::LinkOnceODRLinkage as u32 } {
            return Ok(Linkage::LinkOnceODRLinkage)
        }
        if value == const { Linkage::LinkOnceODRAutoHideLinkage as u32 } {
            return Ok(Linkage::LinkOnceODRAutoHideLinkage)
        }
        if value == const { Linkage::WeakAnyLinkage as u32 } {
            return Ok(Linkage::WeakAnyLinkage)
        }
        if value == const { Linkage::WeakODRLinkage as u32 } {
            return Ok(Linkage::WeakODRLinkage)
        }
        if value == const { Linkage::AppendingLinkage as u32 } {
            return Ok(Linkage::AppendingLinkage)
        }
        if value == const { Linkage::InternalLinkage as u32 } {
            return Ok(Linkage::InternalLinkage)
        }
        if value == const { Linkage::PrivateLinkage as u32 } {
            return Ok(Linkage::PrivateLinkage)
        }
        if value == const { Linkage::DLLImportLinkage as u32 } {
            return Ok(Linkage::DLLImportLinkage)
        }
        if value == const { Linkage::DLLExportLinkage as u32 } {
            return Ok(Linkage::DLLExportLinkage)
        }
        if value == const { Linkage::ExternalWeakLinkage as u32 } {
            return Ok(Linkage::ExternalWeakLinkage)
        }
        if value == const { Linkage::GhostLinkage as u32 } {
            return Ok(Linkage::GhostLinkage)
        }
        if value == const { Linkage::CommonLinkage as u32 } {
            return Ok(Linkage::CommonLinkage)
        }
        if value == const { Linkage::LinkerPrivateLinkage as u32 } {
            return Ok(Linkage::LinkerPrivateLinkage)
        }
        if value == const { Linkage::LinkerPrivateWeakLinkage as u32 } {
            return Ok(Linkage::LinkerPrivateWeakLinkage)
        }
        Err(value)
    }
}TryFromU32)]
188#[repr(C)]
189pub(crate) enum Linkage {
190    ExternalLinkage = 0,
191    AvailableExternallyLinkage = 1,
192    LinkOnceAnyLinkage = 2,
193    LinkOnceODRLinkage = 3,
194    #[deprecated = "marked obsolete by LLVM"]
195    LinkOnceODRAutoHideLinkage = 4,
196    WeakAnyLinkage = 5,
197    WeakODRLinkage = 6,
198    AppendingLinkage = 7,
199    InternalLinkage = 8,
200    PrivateLinkage = 9,
201    #[deprecated = "marked obsolete by LLVM"]
202    DLLImportLinkage = 10,
203    #[deprecated = "marked obsolete by LLVM"]
204    DLLExportLinkage = 11,
205    ExternalWeakLinkage = 12,
206    #[deprecated = "marked obsolete by LLVM"]
207    GhostLinkage = 13,
208    CommonLinkage = 14,
209    LinkerPrivateLinkage = 15,
210    LinkerPrivateWeakLinkage = 16,
211}
212
213/// Must match the layout of `LLVMVisibility`.
214#[repr(C)]
215#[derive(#[automatically_derived]
impl ::core::marker::Copy for Visibility { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Visibility { }
#[automatically_derived]
impl ::core::clone::Clone for Visibility {
    #[inline]
    fn clone(&self) -> Visibility { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Visibility { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Visibility {
    #[inline]
    fn eq(&self, other: &Visibility) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, impl ::core::convert::TryFrom<u32> for Visibility {
    type Error = u32;
    #[allow(deprecated)]
    fn try_from(value: u32)
        -> ::core::result::Result<Visibility, Self::Error> {
        if value == const { Visibility::Default as u32 } {
            return Ok(Visibility::Default)
        }
        if value == const { Visibility::Hidden as u32 } {
            return Ok(Visibility::Hidden)
        }
        if value == const { Visibility::Protected as u32 } {
            return Ok(Visibility::Protected)
        }
        Err(value)
    }
}TryFromU32)]
216pub(crate) enum Visibility {
217    Default = 0,
218    Hidden = 1,
219    Protected = 2,
220}
221
222/// LLVMUnnamedAddr
223#[repr(C)]
224pub(crate) enum UnnamedAddr {
225    No,
226    #[expect(dead_code)]
227    Local,
228    Global,
229}
230
231/// LLVMDLLStorageClass
232#[derive(#[automatically_derived]
impl ::core::marker::Copy for DLLStorageClass { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DLLStorageClass { }
#[automatically_derived]
impl ::core::clone::Clone for DLLStorageClass {
    #[inline]
    fn clone(&self) -> DLLStorageClass { *self }
}Clone)]
233#[repr(C)]
234pub(crate) enum DLLStorageClass {
235    #[allow(dead_code)]
236    Default = 0,
237    DllImport = 1, // Function to be imported from DLL.
238    #[allow(dead_code)]
239    DllExport = 2, // Function to be accessible from DLL.
240}
241
242/// Must match the layout of `llvm::UWTableKind`.
243#[derive(#[automatically_derived]
impl ::core::marker::Copy for UWTableKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for UWTableKind { }
#[automatically_derived]
impl ::core::clone::Clone for UWTableKind {
    #[inline]
    fn clone(&self) -> UWTableKind { *self }
}Clone)]
244#[repr(C)]
245pub(crate) enum UWTableKind {
246    /// No unwind table requested
247    None = 0,
248    /// "Synchronous" unwind tables
249    Sync = 1,
250    /// "Asynchronous" unwind tables (instr precise)
251    Async = 2,
252}
253
254/// Must match the layout of `llvm::FramePointerKind`.
255#[repr(C)]
256#[derive(#[automatically_derived]
impl ::core::marker::Copy for FramePointerKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FramePointerKind { }
#[automatically_derived]
impl ::core::clone::Clone for FramePointerKind {
    #[inline]
    fn clone(&self) -> FramePointerKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for FramePointerKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                FramePointerKind::None => "None",
                FramePointerKind::NonLeaf => "NonLeaf",
                FramePointerKind::All => "All",
                FramePointerKind::Reserved => "Reserved",
                FramePointerKind::NonLeafNoReserve => "NonLeafNoReserve",
            })
    }
}Debug)]
257#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM")]
258pub(crate) enum FramePointerKind {
259    None = 0,
260    NonLeaf = 1,
261    All = 2,
262    Reserved = 3,
263    NonLeafNoReserve = 4,
264}
265
266/// Must match the layout of `LLVMRustAttributeKind`.
267/// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
268/// though it is not ABI compatible (since it's a C++ enum)
269#[repr(C)]
270#[derive(#[automatically_derived]
impl ::core::marker::Copy for AttributeKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for AttributeKind { }
#[automatically_derived]
impl ::core::clone::Clone for AttributeKind {
    #[inline]
    fn clone(&self) -> AttributeKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AttributeKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                AttributeKind::AlwaysInline => "AlwaysInline",
                AttributeKind::ByVal => "ByVal",
                AttributeKind::Cold => "Cold",
                AttributeKind::InlineHint => "InlineHint",
                AttributeKind::MinSize => "MinSize",
                AttributeKind::Naked => "Naked",
                AttributeKind::NoAlias => "NoAlias",
                AttributeKind::CapturesAddress => "CapturesAddress",
                AttributeKind::NoInline => "NoInline",
                AttributeKind::NonNull => "NonNull",
                AttributeKind::NoRedZone => "NoRedZone",
                AttributeKind::NoReturn => "NoReturn",
                AttributeKind::NoUnwind => "NoUnwind",
                AttributeKind::OptimizeForSize => "OptimizeForSize",
                AttributeKind::ReadOnly => "ReadOnly",
                AttributeKind::SExt => "SExt",
                AttributeKind::StructRet => "StructRet",
                AttributeKind::UWTable => "UWTable",
                AttributeKind::ZExt => "ZExt",
                AttributeKind::InReg => "InReg",
                AttributeKind::SanitizeThread => "SanitizeThread",
                AttributeKind::SanitizeAddress => "SanitizeAddress",
                AttributeKind::SanitizeMemory => "SanitizeMemory",
                AttributeKind::NonLazyBind => "NonLazyBind",
                AttributeKind::OptimizeNone => "OptimizeNone",
                AttributeKind::ReadNone => "ReadNone",
                AttributeKind::SanitizeHWAddress => "SanitizeHWAddress",
                AttributeKind::WillReturn => "WillReturn",
                AttributeKind::StackProtectReq => "StackProtectReq",
                AttributeKind::StackProtectStrong => "StackProtectStrong",
                AttributeKind::StackProtect => "StackProtect",
                AttributeKind::NoUndef => "NoUndef",
                AttributeKind::SanitizeMemTag => "SanitizeMemTag",
                AttributeKind::NoCfCheck => "NoCfCheck",
                AttributeKind::ShadowCallStack => "ShadowCallStack",
                AttributeKind::AllocSize => "AllocSize",
                AttributeKind::AllocatedPointer => "AllocatedPointer",
                AttributeKind::AllocAlign => "AllocAlign",
                AttributeKind::SanitizeSafeStack => "SanitizeSafeStack",
                AttributeKind::FnRetThunkExtern => "FnRetThunkExtern",
                AttributeKind::Writable => "Writable",
                AttributeKind::DeadOnUnwind => "DeadOnUnwind",
                AttributeKind::DeadOnReturn => "DeadOnReturn",
                AttributeKind::CapturesReadOnly => "CapturesReadOnly",
                AttributeKind::CapturesNone => "CapturesNone",
                AttributeKind::SanitizeRealtimeNonblocking =>
                    "SanitizeRealtimeNonblocking",
                AttributeKind::SanitizeRealtimeBlocking =>
                    "SanitizeRealtimeBlocking",
                AttributeKind::Convergent => "Convergent",
                AttributeKind::NoFree => "NoFree",
            })
    }
}Debug)]
271#[expect(dead_code, reason = "Some variants are unused, but are kept to match the C++")]
272pub(crate) enum AttributeKind {
273    AlwaysInline = 0,
274    ByVal = 1,
275    Cold = 2,
276    InlineHint = 3,
277    MinSize = 4,
278    Naked = 5,
279    NoAlias = 6,
280    CapturesAddress = 7,
281    NoInline = 8,
282    NonNull = 9,
283    NoRedZone = 10,
284    NoReturn = 11,
285    NoUnwind = 12,
286    OptimizeForSize = 13,
287    ReadOnly = 14,
288    SExt = 15,
289    StructRet = 16,
290    UWTable = 17,
291    ZExt = 18,
292    InReg = 19,
293    SanitizeThread = 20,
294    SanitizeAddress = 21,
295    SanitizeMemory = 22,
296    NonLazyBind = 23,
297    OptimizeNone = 24,
298    ReadNone = 26,
299    SanitizeHWAddress = 28,
300    WillReturn = 29,
301    StackProtectReq = 30,
302    StackProtectStrong = 31,
303    StackProtect = 32,
304    NoUndef = 33,
305    SanitizeMemTag = 34,
306    NoCfCheck = 35,
307    ShadowCallStack = 36,
308    AllocSize = 37,
309    AllocatedPointer = 38,
310    AllocAlign = 39,
311    SanitizeSafeStack = 40,
312    FnRetThunkExtern = 41,
313    Writable = 42,
314    DeadOnUnwind = 43,
315    DeadOnReturn = 44,
316    CapturesReadOnly = 45,
317    CapturesNone = 46,
318    SanitizeRealtimeNonblocking = 47,
319    SanitizeRealtimeBlocking = 48,
320    Convergent = 49,
321    NoFree = 50,
322}
323
324/// LLVMIntPredicate
325#[derive(#[automatically_derived]
impl ::core::marker::Copy for IntPredicate { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for IntPredicate { }
#[automatically_derived]
impl ::core::clone::Clone for IntPredicate {
    #[inline]
    fn clone(&self) -> IntPredicate { *self }
}Clone)]
326#[repr(C)]
327pub(crate) enum IntPredicate {
328    IntEQ = 32,
329    IntNE = 33,
330    IntUGT = 34,
331    IntUGE = 35,
332    IntULT = 36,
333    IntULE = 37,
334    IntSGT = 38,
335    IntSGE = 39,
336    IntSLT = 40,
337    IntSLE = 41,
338}
339
340/// LLVMRealPredicate
341#[derive(#[automatically_derived]
impl ::core::marker::Copy for RealPredicate { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for RealPredicate { }
#[automatically_derived]
impl ::core::clone::Clone for RealPredicate {
    #[inline]
    fn clone(&self) -> RealPredicate { *self }
}Clone)]
342#[repr(C)]
343pub(crate) enum RealPredicate {
344    RealPredicateFalse = 0,
345    RealOEQ = 1,
346    RealOGT = 2,
347    RealOGE = 3,
348    RealOLT = 4,
349    RealOLE = 5,
350    RealONE = 6,
351    RealORD = 7,
352    RealUNO = 8,
353    RealUEQ = 9,
354    RealUGT = 10,
355    RealUGE = 11,
356    RealULT = 12,
357    RealULE = 13,
358    RealUNE = 14,
359    RealPredicateTrue = 15,
360}
361
362/// Must match the layout of `LLVMTypeKind`.
363///
364/// Use [`RawEnum<TypeKind>`] for values of `LLVMTypeKind` returned from LLVM,
365/// to avoid risk of UB if LLVM adds new enum values.
366///
367/// All of LLVM's variants should be declared here, even if no Rust-side code refers
368/// to them, because unknown variants will cause [`RawEnum::to_rust`] to panic.
369#[derive(#[automatically_derived]
impl ::core::marker::Copy for TypeKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for TypeKind { }
#[automatically_derived]
impl ::core::clone::Clone for TypeKind {
    #[inline]
    fn clone(&self) -> TypeKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for TypeKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for TypeKind {
    #[inline]
    fn eq(&self, other: &TypeKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for TypeKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                TypeKind::Void => "Void",
                TypeKind::Half => "Half",
                TypeKind::Float => "Float",
                TypeKind::Double => "Double",
                TypeKind::X86_FP80 => "X86_FP80",
                TypeKind::FP128 => "FP128",
                TypeKind::PPC_FP128 => "PPC_FP128",
                TypeKind::Label => "Label",
                TypeKind::Integer => "Integer",
                TypeKind::Function => "Function",
                TypeKind::Struct => "Struct",
                TypeKind::Array => "Array",
                TypeKind::Pointer => "Pointer",
                TypeKind::Vector => "Vector",
                TypeKind::Metadata => "Metadata",
                TypeKind::Token => "Token",
                TypeKind::ScalableVector => "ScalableVector",
                TypeKind::BFloat => "BFloat",
                TypeKind::X86_AMX => "X86_AMX",
            })
    }
}Debug, impl ::core::convert::TryFrom<u32> for TypeKind {
    type Error = u32;
    #[allow(deprecated)]
    fn try_from(value: u32) -> ::core::result::Result<TypeKind, Self::Error> {
        if value == const { TypeKind::Void as u32 } {
            return Ok(TypeKind::Void)
        }
        if value == const { TypeKind::Half as u32 } {
            return Ok(TypeKind::Half)
        }
        if value == const { TypeKind::Float as u32 } {
            return Ok(TypeKind::Float)
        }
        if value == const { TypeKind::Double as u32 } {
            return Ok(TypeKind::Double)
        }
        if value == const { TypeKind::X86_FP80 as u32 } {
            return Ok(TypeKind::X86_FP80)
        }
        if value == const { TypeKind::FP128 as u32 } {
            return Ok(TypeKind::FP128)
        }
        if value == const { TypeKind::PPC_FP128 as u32 } {
            return Ok(TypeKind::PPC_FP128)
        }
        if value == const { TypeKind::Label as u32 } {
            return Ok(TypeKind::Label)
        }
        if value == const { TypeKind::Integer as u32 } {
            return Ok(TypeKind::Integer)
        }
        if value == const { TypeKind::Function as u32 } {
            return Ok(TypeKind::Function)
        }
        if value == const { TypeKind::Struct as u32 } {
            return Ok(TypeKind::Struct)
        }
        if value == const { TypeKind::Array as u32 } {
            return Ok(TypeKind::Array)
        }
        if value == const { TypeKind::Pointer as u32 } {
            return Ok(TypeKind::Pointer)
        }
        if value == const { TypeKind::Vector as u32 } {
            return Ok(TypeKind::Vector)
        }
        if value == const { TypeKind::Metadata as u32 } {
            return Ok(TypeKind::Metadata)
        }
        if value == const { TypeKind::Token as u32 } {
            return Ok(TypeKind::Token)
        }
        if value == const { TypeKind::ScalableVector as u32 } {
            return Ok(TypeKind::ScalableVector)
        }
        if value == const { TypeKind::BFloat as u32 } {
            return Ok(TypeKind::BFloat)
        }
        if value == const { TypeKind::X86_AMX as u32 } {
            return Ok(TypeKind::X86_AMX)
        }
        Err(value)
    }
}TryFromU32)]
370#[repr(C)]
371pub(crate) enum TypeKind {
372    Void = 0,
373    Half = 1,
374    Float = 2,
375    Double = 3,
376    X86_FP80 = 4,
377    FP128 = 5,
378    PPC_FP128 = 6,
379    Label = 7,
380    Integer = 8,
381    Function = 9,
382    Struct = 10,
383    Array = 11,
384    Pointer = 12,
385    Vector = 13,
386    Metadata = 14,
387    Token = 16,
388    ScalableVector = 17,
389    BFloat = 18,
390    X86_AMX = 19,
391}
392
393/// LLVMAtomicRmwBinOp
394#[derive(#[automatically_derived]
impl ::core::marker::Copy for AtomicRmwBinOp { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for AtomicRmwBinOp { }
#[automatically_derived]
impl ::core::clone::Clone for AtomicRmwBinOp {
    #[inline]
    fn clone(&self) -> AtomicRmwBinOp { *self }
}Clone)]
395#[repr(C)]
396pub(crate) enum AtomicRmwBinOp {
397    AtomicXchg = 0,
398    AtomicAdd = 1,
399    AtomicSub = 2,
400    AtomicAnd = 3,
401    AtomicNand = 4,
402    AtomicOr = 5,
403    AtomicXor = 6,
404    AtomicMax = 7,
405    AtomicMin = 8,
406    AtomicUMax = 9,
407    AtomicUMin = 10,
408}
409
410/// LLVMAtomicOrdering
411#[derive(#[automatically_derived]
impl ::core::marker::Copy for AtomicOrdering { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for AtomicOrdering { }
#[automatically_derived]
impl ::core::clone::Clone for AtomicOrdering {
    #[inline]
    fn clone(&self) -> AtomicOrdering { *self }
}Clone)]
412#[repr(C)]
413pub(crate) enum AtomicOrdering {
414    #[allow(dead_code)]
415    NotAtomic = 0,
416    #[allow(dead_code)]
417    Unordered = 1,
418    Monotonic = 2,
419    // Consume = 3,  // Not specified yet.
420    Acquire = 4,
421    Release = 5,
422    AcquireRelease = 6,
423    SequentiallyConsistent = 7,
424}
425
426/// LLVMRustFileType
427#[derive(#[automatically_derived]
impl ::core::marker::Copy for FileType { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FileType { }
#[automatically_derived]
impl ::core::clone::Clone for FileType {
    #[inline]
    fn clone(&self) -> FileType { *self }
}Clone)]
428#[repr(C)]
429pub(crate) enum FileType {
430    AssemblyFile,
431    ObjectFile,
432}
433
434/// Must match the layout of `LLVMInlineAsmDialect`.
435#[derive(#[automatically_derived]
impl ::core::marker::Copy for AsmDialect { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for AsmDialect { }
#[automatically_derived]
impl ::core::clone::Clone for AsmDialect {
    #[inline]
    fn clone(&self) -> AsmDialect { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for AsmDialect { }
#[automatically_derived]
impl ::core::cmp::PartialEq for AsmDialect {
    #[inline]
    fn eq(&self, other: &AsmDialect) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
436#[repr(C)]
437pub(crate) enum AsmDialect {
438    Att,
439    Intel,
440}
441
442/// LLVMRustCodeGenOptLevel
443#[derive(#[automatically_derived]
impl ::core::marker::Copy for CodeGenOptLevel { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CodeGenOptLevel { }
#[automatically_derived]
impl ::core::clone::Clone for CodeGenOptLevel {
    #[inline]
    fn clone(&self) -> CodeGenOptLevel { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CodeGenOptLevel { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CodeGenOptLevel {
    #[inline]
    fn eq(&self, other: &CodeGenOptLevel) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
444#[repr(C)]
445pub(crate) enum CodeGenOptLevel {
446    None,
447    Less,
448    Default,
449    Aggressive,
450}
451
452/// LLVMRustPassBuilderOptLevel
453#[repr(C)]
454pub(crate) enum PassBuilderOptLevel {
455    O0,
456    O1,
457    O2,
458    O3,
459    Os,
460    Oz,
461}
462
463/// LLVMRustOptStage
464#[derive(#[automatically_derived]
impl ::core::marker::StructuralPartialEq for OptStage { }
#[automatically_derived]
impl ::core::cmp::PartialEq for OptStage {
    #[inline]
    fn eq(&self, other: &OptStage) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
465#[repr(C)]
466pub(crate) enum OptStage {
467    PreLinkNoLTO,
468    PreLinkThinLTO,
469    PreLinkFatLTO,
470    ThinLTO,
471    FatLTO,
472}
473
474/// LLVMRustSanitizerOptions
475#[repr(C)]
476pub(crate) struct SanitizerOptions {
477    pub sanitize_address: bool,
478    pub sanitize_address_recover: bool,
479    pub sanitize_cfi: bool,
480    pub sanitize_dataflow: bool,
481    pub sanitize_dataflow_abilist: *const *const c_char,
482    pub sanitize_dataflow_abilist_len: size_t,
483    pub sanitize_kcfi: bool,
484    pub sanitize_memory: bool,
485    pub sanitize_memory_recover: bool,
486    pub sanitize_memory_track_origins: c_int,
487    pub sanitize_realtime: bool,
488    pub sanitize_thread: bool,
489    pub sanitize_hwaddress: bool,
490    pub sanitize_hwaddress_recover: bool,
491    pub sanitize_kernel_address: bool,
492    pub sanitize_kernel_address_recover: bool,
493    pub sanitize_kernel_hwaddress: bool,
494    pub sanitize_kernel_hwaddress_recover: bool,
495}
496
497/// LLVMRustRelocModel
498#[derive(#[automatically_derived]
impl ::core::marker::Copy for RelocModel { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for RelocModel { }
#[automatically_derived]
impl ::core::clone::Clone for RelocModel {
    #[inline]
    fn clone(&self) -> RelocModel { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for RelocModel { }
#[automatically_derived]
impl ::core::cmp::PartialEq for RelocModel {
    #[inline]
    fn eq(&self, other: &RelocModel) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
499#[repr(C)]
500pub(crate) enum RelocModel {
501    Static,
502    PIC,
503    DynamicNoPic,
504    ROPI,
505    RWPI,
506    ROPI_RWPI,
507}
508
509/// LLVMRustFloatABI
510#[derive(#[automatically_derived]
impl ::core::marker::Copy for FloatAbi { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for FloatAbi { }
#[automatically_derived]
impl ::core::clone::Clone for FloatAbi {
    #[inline]
    fn clone(&self) -> FloatAbi { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for FloatAbi { }
#[automatically_derived]
impl ::core::cmp::PartialEq for FloatAbi {
    #[inline]
    fn eq(&self, other: &FloatAbi) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
511#[repr(C)]
512pub(crate) enum FloatAbi {
513    Default,
514    Soft,
515    Hard,
516}
517
518/// LLVMRustCodeModel
519#[derive(#[automatically_derived]
impl ::core::marker::Copy for CodeModel { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CodeModel { }
#[automatically_derived]
impl ::core::clone::Clone for CodeModel {
    #[inline]
    fn clone(&self) -> CodeModel { *self }
}Clone)]
520#[repr(C)]
521pub(crate) enum CodeModel {
522    Tiny,
523    Small,
524    Kernel,
525    Medium,
526    Large,
527    None,
528}
529
530/// LLVMRustDiagnosticKind
531#[derive(#[automatically_derived]
#[allow(dead_code)]
impl ::core::marker::Copy for DiagnosticKind { }Copy, #[automatically_derived]
#[doc(hidden)]
#[allow(dead_code)]
unsafe impl ::core::clone::TrivialClone for DiagnosticKind { }
#[automatically_derived]
#[allow(dead_code)]
impl ::core::clone::Clone for DiagnosticKind {
    #[inline]
    fn clone(&self) -> DiagnosticKind { *self }
}Clone)]
532#[repr(C)]
533#[allow(dead_code)] // Variants constructed by C++.
534pub(crate) enum DiagnosticKind {
535    Other,
536    InlineAsm,
537    StackSize,
538    DebugMetadataVersion,
539    SampleProfile,
540    OptimizationRemark,
541    OptimizationRemarkMissed,
542    OptimizationRemarkAnalysis,
543    OptimizationRemarkAnalysisFPCommute,
544    OptimizationRemarkAnalysisAliasing,
545    OptimizationRemarkOther,
546    OptimizationFailure,
547    PGOProfile,
548    Linker,
549    Unsupported,
550    SrcMgr,
551}
552
553/// LLVMRustDiagnosticLevel
554#[derive(#[automatically_derived]
#[allow(dead_code)]
impl ::core::marker::Copy for DiagnosticLevel { }Copy, #[automatically_derived]
#[doc(hidden)]
#[allow(dead_code)]
unsafe impl ::core::clone::TrivialClone for DiagnosticLevel { }
#[automatically_derived]
#[allow(dead_code)]
impl ::core::clone::Clone for DiagnosticLevel {
    #[inline]
    fn clone(&self) -> DiagnosticLevel { *self }
}Clone)]
555#[repr(C)]
556#[allow(dead_code)] // Variants constructed by C++.
557pub(crate) enum DiagnosticLevel {
558    Error,
559    Warning,
560    Note,
561    Remark,
562}
563
564unsafe extern "C" {
565    // LLVMRustThinLTOData
566    pub(crate) type ThinLTOData;
567}
568
569/// LLVMRustThinLTOModule
570#[repr(C)]
571pub(crate) struct ThinLTOModule {
572    pub identifier: *const c_char,
573    pub data: *const u8,
574    pub len: usize,
575}
576
577/// LLVMThreadLocalMode
578#[derive(#[automatically_derived]
impl ::core::marker::Copy for ThreadLocalMode { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ThreadLocalMode { }
#[automatically_derived]
impl ::core::clone::Clone for ThreadLocalMode {
    #[inline]
    fn clone(&self) -> ThreadLocalMode { *self }
}Clone)]
579#[repr(C)]
580pub(crate) enum ThreadLocalMode {
581    #[expect(dead_code)]
582    NotThreadLocal,
583    GeneralDynamic,
584    LocalDynamic,
585    InitialExec,
586    LocalExec,
587}
588
589/// LLVMRustChecksumKind
590#[derive(#[automatically_derived]
impl ::core::marker::Copy for ChecksumKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ChecksumKind { }
#[automatically_derived]
impl ::core::clone::Clone for ChecksumKind {
    #[inline]
    fn clone(&self) -> ChecksumKind { *self }
}Clone)]
591#[repr(C)]
592pub(crate) enum ChecksumKind {
593    None,
594    MD5,
595    SHA1,
596    SHA256,
597}
598
599/// LLVMRustMemoryEffects
600#[derive(#[automatically_derived]
impl ::core::marker::Copy for MemoryEffects { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MemoryEffects { }
#[automatically_derived]
impl ::core::clone::Clone for MemoryEffects {
    #[inline]
    fn clone(&self) -> MemoryEffects { *self }
}Clone)]
601#[repr(C)]
602pub(crate) enum MemoryEffects {
603    None,
604    ReadOnly,
605    InaccessibleMemOnly,
606    ReadOnlyNotPure,
607}
608
609/// LLVMOpcode
610#[derive(#[automatically_derived]
impl ::core::marker::Copy for Opcode { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Opcode { }
#[automatically_derived]
impl ::core::clone::Clone for Opcode {
    #[inline]
    fn clone(&self) -> Opcode { *self }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Opcode { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Opcode {
    #[inline]
    fn eq(&self, other: &Opcode) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Opcode { }Eq)]
611#[repr(C)]
612#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM-C")]
613pub(crate) enum Opcode {
614    Ret = 1,
615    Br = 2,
616    Switch = 3,
617    IndirectBr = 4,
618    Invoke = 5,
619    Unreachable = 7,
620    CallBr = 67,
621    FNeg = 66,
622    Add = 8,
623    FAdd = 9,
624    Sub = 10,
625    FSub = 11,
626    Mul = 12,
627    FMul = 13,
628    UDiv = 14,
629    SDiv = 15,
630    FDiv = 16,
631    URem = 17,
632    SRem = 18,
633    FRem = 19,
634    Shl = 20,
635    LShr = 21,
636    AShr = 22,
637    And = 23,
638    Or = 24,
639    Xor = 25,
640    Alloca = 26,
641    Load = 27,
642    Store = 28,
643    GetElementPtr = 29,
644    Trunc = 30,
645    ZExt = 31,
646    SExt = 32,
647    FPToUI = 33,
648    FPToSI = 34,
649    UIToFP = 35,
650    SIToFP = 36,
651    FPTrunc = 37,
652    FPExt = 38,
653    PtrToInt = 39,
654    IntToPtr = 40,
655    BitCast = 41,
656    AddrSpaceCast = 60,
657    ICmp = 42,
658    FCmp = 43,
659    PHI = 44,
660    Call = 45,
661    Select = 46,
662    UserOp1 = 47,
663    UserOp2 = 48,
664    VAArg = 49,
665    ExtractElement = 50,
666    InsertElement = 51,
667    ShuffleVector = 52,
668    ExtractValue = 53,
669    InsertValue = 54,
670    Freeze = 68,
671    Fence = 55,
672    AtomicCmpXchg = 56,
673    AtomicRMW = 57,
674    Resume = 58,
675    LandingPad = 59,
676    CleanupRet = 61,
677    CatchRet = 62,
678    CatchPad = 63,
679    CleanupPad = 64,
680    CatchSwitch = 65,
681}
682
683/// Must match the layout of `LLVMRustCompressionKind`.
684#[derive(#[automatically_derived]
impl ::core::marker::Copy for CompressionKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CompressionKind { }
#[automatically_derived]
impl ::core::clone::Clone for CompressionKind {
    #[inline]
    fn clone(&self) -> CompressionKind { *self }
}Clone)]
685#[repr(C)]
686pub(crate) enum CompressionKind {
687    None = 0,
688    Zlib = 1,
689    Zstd = 2,
690}
691
692unsafe extern "C" {
693    type Opaque;
694}
695#[repr(C)]
696struct InvariantOpaque<'a> {
697    _marker: PhantomData<&'a mut &'a ()>,
698    _opaque: Opaque,
699}
700
701// Opaque pointer types
702unsafe extern "C" {
703    pub(crate) type Module;
704    pub(crate) type Context;
705    pub(crate) type Type;
706    pub(crate) type Value;
707    pub(crate) type ConstantInt;
708    pub(crate) type Attribute;
709    pub(crate) type Metadata;
710    pub(crate) type BasicBlock;
711    pub(crate) type Comdat;
712    /// `&'ll DbgRecord` represents `LLVMDbgRecordRef`.
713    pub(crate) type DbgRecord;
714}
715#[repr(C)]
716pub(crate) struct Builder<'a>(InvariantOpaque<'a>);
717#[repr(C)]
718pub(crate) struct PassManager<'a>(InvariantOpaque<'a>);
719unsafe extern "C" {
720    pub type TargetMachine;
721}
722unsafe extern "C" {
723    pub(crate) type MCSubtargetInfo;
724    pub(crate) type Twine;
725    pub(crate) type DiagnosticInfo;
726    pub(crate) type SMDiagnostic;
727}
728/// Opaque pointee of `LLVMOperandBundleRef`.
729#[repr(C)]
730pub(crate) struct OperandBundle<'a>(InvariantOpaque<'a>);
731#[repr(C)]
732pub(crate) struct Linker<'a>(InvariantOpaque<'a>);
733
734unsafe extern "C" {
735    pub(crate) type DiagnosticHandler;
736}
737
738pub(crate) type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
739
740pub(crate) mod debuginfo {
741    use bitflags::bitflags;
742
743    use super::{InvariantOpaque, Metadata};
744
745    /// Opaque target type for references to an LLVM debuginfo builder.
746    ///
747    /// `&'_ DIBuilder<'ll>` corresponds to `LLVMDIBuilderRef`, which is the
748    /// LLVM-C wrapper for `DIBuilder *`.
749    ///
750    /// Debuginfo builders are created and destroyed during codegen, so the
751    /// builder reference typically has a shorter lifetime than the LLVM
752    /// session (`'ll`) that it participates in.
753    #[repr(C)]
754    pub(crate) struct DIBuilder<'ll>(InvariantOpaque<'ll>);
755
756    pub(crate) type DIDescriptor = Metadata;
757    pub(crate) type DILocation = Metadata;
758    pub(crate) type DIScope = DIDescriptor;
759    pub(crate) type DIFile = DIScope;
760    pub(crate) type DILexicalBlock = DIScope;
761    pub(crate) type DISubprogram = DIScope;
762    pub(crate) type DIType = DIDescriptor;
763    pub(crate) type DIBasicType = DIType;
764    pub(crate) type DIDerivedType = DIType;
765    pub(crate) type DICompositeType = DIDerivedType;
766    pub(crate) type DIVariable = DIDescriptor;
767    pub(crate) type DIArray = DIDescriptor;
768    pub(crate) type DITemplateTypeParameter = DIDescriptor;
769
770    #[doc = r" Must match the layout of `LLVMDIFlags` in the LLVM-C API."]
#[doc = r""]
#[doc = r" Each value declared here must also be covered by the static"]
#[doc = r" assertions in `RustWrapper.cpp` used by `fromRust(LLVMDIFlags)`."]
#[repr(transparent)]
pub(crate) struct DIFlags(<DIFlags as
    ::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DIFlags { }
#[automatically_derived]
impl ::core::clone::Clone for DIFlags {
    #[inline]
    fn clone(&self) -> DIFlags {
        let _:
                ::core::clone::AssertParamIsClone<<DIFlags as
                ::bitflags::__private::PublicFlags>::Internal>;
        *self
    }
}
#[automatically_derived]
impl ::core::marker::Copy for DIFlags { }
#[automatically_derived]
impl ::core::default::Default for DIFlags {
    #[inline]
    fn default() -> DIFlags { DIFlags(::core::default::Default::default()) }
}
impl DIFlags {
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagZero: Self = Self::from_bits_retain(0);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagPrivate: Self = Self::from_bits_retain(1);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagProtected: Self = Self::from_bits_retain(2);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagPublic: Self = Self::from_bits_retain(3);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagFwdDecl: Self = Self::from_bits_retain((1 << 2));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagAppleBlock: Self = Self::from_bits_retain((1 << 3));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagReservedBit4: Self = Self::from_bits_retain((1 << 4));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagVirtual: Self = Self::from_bits_retain((1 << 5));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagArtificial: Self = Self::from_bits_retain((1 << 6));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagExplicit: Self = Self::from_bits_retain((1 << 7));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagPrototyped: Self = Self::from_bits_retain((1 << 8));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagObjcClassComplete: Self = Self::from_bits_retain((1 << 9));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagObjectPointer: Self = Self::from_bits_retain((1 << 10));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagVector: Self = Self::from_bits_retain((1 << 11));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagStaticMember: Self = Self::from_bits_retain((1 << 12));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagLValueReference: Self = Self::from_bits_retain((1 << 13));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagRValueReference: Self = Self::from_bits_retain((1 << 14));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagReserved: Self = Self::from_bits_retain((1 << 15));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagSingleInheritance: Self = Self::from_bits_retain((1 << 16));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagMultipleInheritance: Self =
        Self::from_bits_retain((2 << 16));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagVirtualInheritance: Self =
        Self::from_bits_retain((3 << 16));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagIntroducedVirtual: Self = Self::from_bits_retain((1 << 18));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagBitField: Self = Self::from_bits_retain((1 << 19));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagNoReturn: Self = Self::from_bits_retain((1 << 20));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagTypePassByValue: Self = Self::from_bits_retain((1 << 22));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagTypePassByReference: Self =
        Self::from_bits_retain((1 << 23));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagEnumClass: Self = Self::from_bits_retain((1 << 24));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagThunk: Self = Self::from_bits_retain((1 << 25));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagNonTrivial: Self = Self::from_bits_retain((1 << 26));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagBigEndian: Self = Self::from_bits_retain((1 << 27));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const FlagLittleEndian: Self = Self::from_bits_retain((1 << 28));
}
impl ::bitflags::Flags for DIFlags {
    const FLAGS: &'static [::bitflags::Flag<DIFlags>] =
        &[{

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagZero", DIFlags::FlagZero)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagPrivate", DIFlags::FlagPrivate)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagProtected",
                            DIFlags::FlagProtected)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagPublic", DIFlags::FlagPublic)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagFwdDecl", DIFlags::FlagFwdDecl)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagAppleBlock",
                            DIFlags::FlagAppleBlock)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagReservedBit4",
                            DIFlags::FlagReservedBit4)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagVirtual", DIFlags::FlagVirtual)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagArtificial",
                            DIFlags::FlagArtificial)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagExplicit", DIFlags::FlagExplicit)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagPrototyped",
                            DIFlags::FlagPrototyped)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagObjcClassComplete",
                            DIFlags::FlagObjcClassComplete)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagObjectPointer",
                            DIFlags::FlagObjectPointer)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagVector", DIFlags::FlagVector)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagStaticMember",
                            DIFlags::FlagStaticMember)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagLValueReference",
                            DIFlags::FlagLValueReference)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagRValueReference",
                            DIFlags::FlagRValueReference)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagReserved", DIFlags::FlagReserved)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagSingleInheritance",
                            DIFlags::FlagSingleInheritance)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagMultipleInheritance",
                            DIFlags::FlagMultipleInheritance)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagVirtualInheritance",
                            DIFlags::FlagVirtualInheritance)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagIntroducedVirtual",
                            DIFlags::FlagIntroducedVirtual)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagBitField", DIFlags::FlagBitField)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagNoReturn", DIFlags::FlagNoReturn)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagTypePassByValue",
                            DIFlags::FlagTypePassByValue)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagTypePassByReference",
                            DIFlags::FlagTypePassByReference)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagEnumClass",
                            DIFlags::FlagEnumClass)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagThunk", DIFlags::FlagThunk)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagNonTrivial",
                            DIFlags::FlagNonTrivial)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagBigEndian",
                            DIFlags::FlagBigEndian)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("FlagLittleEndian",
                            DIFlags::FlagLittleEndian)
                    }];
    type Bits = u32;
    fn bits(&self) -> u32 { DIFlags::bits(self) }
    fn from_bits_retain(bits: u32) -> DIFlags {
        DIFlags::from_bits_retain(bits)
    }
}
#[allow(dead_code, deprecated, unused_doc_comments, unused_attributes,
unused_mut, unused_imports, non_upper_case_globals, clippy ::
assign_op_pattern, clippy :: indexing_slicing, clippy :: same_name_method,
clippy :: iter_without_into_iter,)]
const _: () =
    {
        #[repr(transparent)]
        pub(crate) struct InternalBitFlags(u32);
        #[automatically_derived]
        #[doc(hidden)]
        unsafe impl ::core::clone::TrivialClone for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::clone::Clone for InternalBitFlags {
            #[inline]
            fn clone(&self) -> InternalBitFlags {
                let _: ::core::clone::AssertParamIsClone<u32>;
                *self
            }
        }
        #[automatically_derived]
        impl ::core::marker::Copy for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::marker::StructuralPartialEq for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::cmp::PartialEq for InternalBitFlags {
            #[inline]
            fn eq(&self, other: &InternalBitFlags) -> bool {
                self.0 == other.0
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Eq for InternalBitFlags {
            #[inline]
            #[doc(hidden)]
            #[coverage(off)]
            fn assert_fields_are_eq(&self) {
                let _: ::core::cmp::AssertParamIsEq<u32>;
            }
        }
        #[automatically_derived]
        impl ::core::cmp::PartialOrd for InternalBitFlags {
            #[inline]
            fn partial_cmp(&self, other: &InternalBitFlags)
                -> ::core::option::Option<::core::cmp::Ordering> {
                ::core::option::Option::Some(::core::cmp::Ord::cmp(self,
                        other))
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Ord for InternalBitFlags {
            #[inline]
            fn cmp(&self, other: &InternalBitFlags) -> ::core::cmp::Ordering {
                ::core::cmp::Ord::cmp(&self.0, &other.0)
            }
        }
        #[automatically_derived]
        impl ::core::hash::Hash for InternalBitFlags {
            #[inline]
            fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
                ::core::hash::Hash::hash(&self.0, state)
            }
        }
        impl ::bitflags::__private::PublicFlags for DIFlags {
            type Primitive = u32;
            type Internal = InternalBitFlags;
        }
        impl ::bitflags::__private::core::default::Default for
            InternalBitFlags {
            #[inline]
            fn default() -> Self { InternalBitFlags::empty() }
        }
        impl ::bitflags::__private::core::fmt::Debug for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                if self.is_empty() {
                    f.write_fmt(format_args!("{0:#x}",
                            <u32 as ::bitflags::Bits>::EMPTY))
                } else {
                    ::bitflags::__private::core::fmt::Display::fmt(self, f)
                }
            }
        }
        impl ::bitflags::__private::core::fmt::Display for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                ::bitflags::parser::to_writer(&DIFlags(*self), f)
            }
        }
        impl ::bitflags::__private::core::str::FromStr for InternalBitFlags {
            type Err = ::bitflags::parser::ParseError;
            fn from_str(s: &str)
                ->
                    ::bitflags::__private::core::result::Result<Self,
                    Self::Err> {
                ::bitflags::parser::from_str::<DIFlags>(s).map(|flags|
                        flags.0)
            }
        }
        impl ::bitflags::__private::core::convert::AsRef<u32> for
            InternalBitFlags {
            fn as_ref(&self) -> &u32 { &self.0 }
        }
        impl ::bitflags::__private::core::convert::From<u32> for
            InternalBitFlags {
            fn from(bits: u32) -> Self { Self::from_bits_retain(bits) }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl InternalBitFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self {
                Self(<u32 as ::bitflags::Bits>::EMPTY)
            }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self {
                let mut truncated = <u32 as ::bitflags::Bits>::EMPTY;
                let mut i = 0;
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DIFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                let _ = i;
                Self(truncated)
            }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> u32 { self.0 }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: u32)
                -> ::bitflags::__private::core::option::Option<Self> {
                let truncated = Self::from_bits_truncate(bits).0;
                if truncated == bits {
                    ::bitflags::__private::core::option::Option::Some(Self(bits))
                } else { ::bitflags::__private::core::option::Option::None }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: u32) -> Self {
                Self(bits & Self::all().0)
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: u32) -> Self { Self(bits) }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                {
                    if name == "FlagZero" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagZero.bits()));
                    }
                };
                ;
                {
                    if name == "FlagPrivate" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagPrivate.bits()));
                    }
                };
                ;
                {
                    if name == "FlagProtected" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagProtected.bits()));
                    }
                };
                ;
                {
                    if name == "FlagPublic" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagPublic.bits()));
                    }
                };
                ;
                {
                    if name == "FlagFwdDecl" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagFwdDecl.bits()));
                    }
                };
                ;
                {
                    if name == "FlagAppleBlock" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagAppleBlock.bits()));
                    }
                };
                ;
                {
                    if name == "FlagReservedBit4" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagReservedBit4.bits()));
                    }
                };
                ;
                {
                    if name == "FlagVirtual" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagVirtual.bits()));
                    }
                };
                ;
                {
                    if name == "FlagArtificial" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagArtificial.bits()));
                    }
                };
                ;
                {
                    if name == "FlagExplicit" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagExplicit.bits()));
                    }
                };
                ;
                {
                    if name == "FlagPrototyped" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagPrototyped.bits()));
                    }
                };
                ;
                {
                    if name == "FlagObjcClassComplete" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagObjcClassComplete.bits()));
                    }
                };
                ;
                {
                    if name == "FlagObjectPointer" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagObjectPointer.bits()));
                    }
                };
                ;
                {
                    if name == "FlagVector" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagVector.bits()));
                    }
                };
                ;
                {
                    if name == "FlagStaticMember" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagStaticMember.bits()));
                    }
                };
                ;
                {
                    if name == "FlagLValueReference" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagLValueReference.bits()));
                    }
                };
                ;
                {
                    if name == "FlagRValueReference" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagRValueReference.bits()));
                    }
                };
                ;
                {
                    if name == "FlagReserved" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagReserved.bits()));
                    }
                };
                ;
                {
                    if name == "FlagSingleInheritance" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagSingleInheritance.bits()));
                    }
                };
                ;
                {
                    if name == "FlagMultipleInheritance" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagMultipleInheritance.bits()));
                    }
                };
                ;
                {
                    if name == "FlagVirtualInheritance" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagVirtualInheritance.bits()));
                    }
                };
                ;
                {
                    if name == "FlagIntroducedVirtual" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagIntroducedVirtual.bits()));
                    }
                };
                ;
                {
                    if name == "FlagBitField" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagBitField.bits()));
                    }
                };
                ;
                {
                    if name == "FlagNoReturn" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagNoReturn.bits()));
                    }
                };
                ;
                {
                    if name == "FlagTypePassByValue" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagTypePassByValue.bits()));
                    }
                };
                ;
                {
                    if name == "FlagTypePassByReference" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagTypePassByReference.bits()));
                    }
                };
                ;
                {
                    if name == "FlagEnumClass" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagEnumClass.bits()));
                    }
                };
                ;
                {
                    if name == "FlagThunk" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagThunk.bits()));
                    }
                };
                ;
                {
                    if name == "FlagNonTrivial" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagNonTrivial.bits()));
                    }
                };
                ;
                {
                    if name == "FlagBigEndian" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagBigEndian.bits()));
                    }
                };
                ;
                {
                    if name == "FlagLittleEndian" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DIFlags::FlagLittleEndian.bits()));
                    }
                };
                ;
                let _ = name;
                ::bitflags::__private::core::option::Option::None
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool {
                self.0 == <u32 as ::bitflags::Bits>::EMPTY
            }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool {
                Self::all().0 | self.0 == self.0
            }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0 & other.0 != <u32 as ::bitflags::Bits>::EMPTY
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0 & other.0 == other.0
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) {
                *self = Self(self.0).union(other);
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) {
                *self = Self(self.0).difference(other);
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) {
                *self = Self(self.0).symmetric_difference(other);
            }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                if value { self.insert(other); } else { self.remove(other); }
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0 & other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0 | other.0)
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0 & !other.0)
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0 ^ other.0)
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self::from_bits_truncate(!self.0)
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for InternalBitFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: InternalBitFlags) -> Self {
                self.union(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for InternalBitFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for
            InternalBitFlags {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for InternalBitFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for
            InternalBitFlags {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for InternalBitFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for InternalBitFlags
            {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for InternalBitFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<InternalBitFlags> for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<InternalBitFlags>
            for InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl InternalBitFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self) -> ::bitflags::iter::Iter<DIFlags> {
                ::bitflags::iter::Iter::__private_const_new(<DIFlags as
                        ::bitflags::Flags>::FLAGS,
                    DIFlags::from_bits_retain(self.bits()),
                    DIFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<DIFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<DIFlags as
                        ::bitflags::Flags>::FLAGS,
                    DIFlags::from_bits_retain(self.bits()),
                    DIFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for
            InternalBitFlags {
            type Item = DIFlags;
            type IntoIter = ::bitflags::iter::Iter<DIFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
        impl InternalBitFlags {
            /// Returns a mutable reference to the raw value of the flags currently stored.
            #[inline]
            pub fn bits_mut(&mut self) -> &mut u32 { &mut self.0 }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl DIFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self { Self(InternalBitFlags::empty()) }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self { Self(InternalBitFlags::all()) }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> u32 { self.0.bits() }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: u32)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_bits(bits) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: u32) -> Self {
                Self(InternalBitFlags::from_bits_truncate(bits))
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: u32) -> Self {
                Self(InternalBitFlags::from_bits_retain(bits))
            }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_name(name) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool { self.0.is_empty() }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool { self.0.is_all() }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0.intersects(other.0)
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0.contains(other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) { self.0.insert(other.0) }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) { self.0.remove(other.0) }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) { self.0.toggle(other.0) }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                self.0.set(other.0, value)
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0.intersection(other.0))
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0.union(other.0))
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0.difference(other.0))
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0.symmetric_difference(other.0))
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self(self.0.complement())
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for DIFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for DIFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for DIFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for DIFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for DIFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: DIFlags) -> Self { self.union(other) }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for DIFlags {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for DIFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for DIFlags {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for DIFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for DIFlags {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for DIFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for DIFlags {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for DIFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<DIFlags> for DIFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<DIFlags> for
            DIFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl DIFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self) -> ::bitflags::iter::Iter<DIFlags> {
                ::bitflags::iter::Iter::__private_const_new(<DIFlags as
                        ::bitflags::Flags>::FLAGS,
                    DIFlags::from_bits_retain(self.bits()),
                    DIFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<DIFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<DIFlags as
                        ::bitflags::Flags>::FLAGS,
                    DIFlags::from_bits_retain(self.bits()),
                    DIFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for DIFlags {
            type Item = DIFlags;
            type IntoIter = ::bitflags::iter::Iter<DIFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
    };bitflags! {
771        /// Must match the layout of `LLVMDIFlags` in the LLVM-C API.
772        ///
773        /// Each value declared here must also be covered by the static
774        /// assertions in `RustWrapper.cpp` used by `fromRust(LLVMDIFlags)`.
775        #[repr(transparent)]
776        #[derive(Clone, Copy, Default)]
777        pub(crate) struct DIFlags: u32 {
778            const FlagZero                = 0;
779            const FlagPrivate             = 1;
780            const FlagProtected           = 2;
781            const FlagPublic              = 3;
782            const FlagFwdDecl             = (1 << 2);
783            const FlagAppleBlock          = (1 << 3);
784            const FlagReservedBit4        = (1 << 4);
785            const FlagVirtual             = (1 << 5);
786            const FlagArtificial          = (1 << 6);
787            const FlagExplicit            = (1 << 7);
788            const FlagPrototyped          = (1 << 8);
789            const FlagObjcClassComplete   = (1 << 9);
790            const FlagObjectPointer       = (1 << 10);
791            const FlagVector              = (1 << 11);
792            const FlagStaticMember        = (1 << 12);
793            const FlagLValueReference     = (1 << 13);
794            const FlagRValueReference     = (1 << 14);
795            const FlagReserved            = (1 << 15);
796            const FlagSingleInheritance   = (1 << 16);
797            const FlagMultipleInheritance = (2 << 16);
798            const FlagVirtualInheritance  = (3 << 16);
799            const FlagIntroducedVirtual   = (1 << 18);
800            const FlagBitField            = (1 << 19);
801            const FlagNoReturn            = (1 << 20);
802            // The bit at (1 << 21) is unused, but was `LLVMDIFlagMainSubprogram`.
803            const FlagTypePassByValue     = (1 << 22);
804            const FlagTypePassByReference = (1 << 23);
805            const FlagEnumClass           = (1 << 24);
806            const FlagThunk               = (1 << 25);
807            const FlagNonTrivial          = (1 << 26);
808            const FlagBigEndian           = (1 << 27);
809            const FlagLittleEndian        = (1 << 28);
810        }
811    }
812
813    // These values **must** match with LLVMRustDISPFlags!!
814    #[repr(transparent)]
pub(crate) struct DISPFlags(<DISPFlags as
    ::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DISPFlags { }
#[automatically_derived]
impl ::core::clone::Clone for DISPFlags {
    #[inline]
    fn clone(&self) -> DISPFlags {
        let _:
                ::core::clone::AssertParamIsClone<<DISPFlags as
                ::bitflags::__private::PublicFlags>::Internal>;
        *self
    }
}
#[automatically_derived]
impl ::core::marker::Copy for DISPFlags { }
#[automatically_derived]
impl ::core::default::Default for DISPFlags {
    #[inline]
    fn default() -> DISPFlags {
        DISPFlags(::core::default::Default::default())
    }
}
impl DISPFlags {
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagZero: Self = Self::from_bits_retain(0);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagVirtual: Self = Self::from_bits_retain(1);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagPureVirtual: Self = Self::from_bits_retain(2);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagLocalToUnit: Self = Self::from_bits_retain((1 << 2));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagDefinition: Self = Self::from_bits_retain((1 << 3));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagOptimized: Self = Self::from_bits_retain((1 << 4));
    #[allow(deprecated, non_upper_case_globals,)]
    pub const SPFlagMainSubprogram: Self = Self::from_bits_retain((1 << 5));
}
impl ::bitflags::Flags for DISPFlags {
    const FLAGS: &'static [::bitflags::Flag<DISPFlags>] =
        &[{

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagZero", DISPFlags::SPFlagZero)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagVirtual",
                            DISPFlags::SPFlagVirtual)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagPureVirtual",
                            DISPFlags::SPFlagPureVirtual)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagLocalToUnit",
                            DISPFlags::SPFlagLocalToUnit)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagDefinition",
                            DISPFlags::SPFlagDefinition)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagOptimized",
                            DISPFlags::SPFlagOptimized)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("SPFlagMainSubprogram",
                            DISPFlags::SPFlagMainSubprogram)
                    }];
    type Bits = u32;
    fn bits(&self) -> u32 { DISPFlags::bits(self) }
    fn from_bits_retain(bits: u32) -> DISPFlags {
        DISPFlags::from_bits_retain(bits)
    }
}
#[allow(dead_code, deprecated, unused_doc_comments, unused_attributes,
unused_mut, unused_imports, non_upper_case_globals, clippy ::
assign_op_pattern, clippy :: indexing_slicing, clippy :: same_name_method,
clippy :: iter_without_into_iter,)]
const _: () =
    {
        #[repr(transparent)]
        pub(crate) struct InternalBitFlags(u32);
        #[automatically_derived]
        #[doc(hidden)]
        unsafe impl ::core::clone::TrivialClone for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::clone::Clone for InternalBitFlags {
            #[inline]
            fn clone(&self) -> InternalBitFlags {
                let _: ::core::clone::AssertParamIsClone<u32>;
                *self
            }
        }
        #[automatically_derived]
        impl ::core::marker::Copy for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::marker::StructuralPartialEq for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::cmp::PartialEq for InternalBitFlags {
            #[inline]
            fn eq(&self, other: &InternalBitFlags) -> bool {
                self.0 == other.0
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Eq for InternalBitFlags {
            #[inline]
            #[doc(hidden)]
            #[coverage(off)]
            fn assert_fields_are_eq(&self) {
                let _: ::core::cmp::AssertParamIsEq<u32>;
            }
        }
        #[automatically_derived]
        impl ::core::cmp::PartialOrd for InternalBitFlags {
            #[inline]
            fn partial_cmp(&self, other: &InternalBitFlags)
                -> ::core::option::Option<::core::cmp::Ordering> {
                ::core::option::Option::Some(::core::cmp::Ord::cmp(self,
                        other))
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Ord for InternalBitFlags {
            #[inline]
            fn cmp(&self, other: &InternalBitFlags) -> ::core::cmp::Ordering {
                ::core::cmp::Ord::cmp(&self.0, &other.0)
            }
        }
        #[automatically_derived]
        impl ::core::hash::Hash for InternalBitFlags {
            #[inline]
            fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
                ::core::hash::Hash::hash(&self.0, state)
            }
        }
        impl ::bitflags::__private::PublicFlags for DISPFlags {
            type Primitive = u32;
            type Internal = InternalBitFlags;
        }
        impl ::bitflags::__private::core::default::Default for
            InternalBitFlags {
            #[inline]
            fn default() -> Self { InternalBitFlags::empty() }
        }
        impl ::bitflags::__private::core::fmt::Debug for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                if self.is_empty() {
                    f.write_fmt(format_args!("{0:#x}",
                            <u32 as ::bitflags::Bits>::EMPTY))
                } else {
                    ::bitflags::__private::core::fmt::Display::fmt(self, f)
                }
            }
        }
        impl ::bitflags::__private::core::fmt::Display for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                ::bitflags::parser::to_writer(&DISPFlags(*self), f)
            }
        }
        impl ::bitflags::__private::core::str::FromStr for InternalBitFlags {
            type Err = ::bitflags::parser::ParseError;
            fn from_str(s: &str)
                ->
                    ::bitflags::__private::core::result::Result<Self,
                    Self::Err> {
                ::bitflags::parser::from_str::<DISPFlags>(s).map(|flags|
                        flags.0)
            }
        }
        impl ::bitflags::__private::core::convert::AsRef<u32> for
            InternalBitFlags {
            fn as_ref(&self) -> &u32 { &self.0 }
        }
        impl ::bitflags::__private::core::convert::From<u32> for
            InternalBitFlags {
            fn from(bits: u32) -> Self { Self::from_bits_retain(bits) }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl InternalBitFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self {
                Self(<u32 as ::bitflags::Bits>::EMPTY)
            }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self {
                let mut truncated = <u32 as ::bitflags::Bits>::EMPTY;
                let mut i = 0;
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <DISPFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                let _ = i;
                Self(truncated)
            }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> u32 { self.0 }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: u32)
                -> ::bitflags::__private::core::option::Option<Self> {
                let truncated = Self::from_bits_truncate(bits).0;
                if truncated == bits {
                    ::bitflags::__private::core::option::Option::Some(Self(bits))
                } else { ::bitflags::__private::core::option::Option::None }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: u32) -> Self {
                Self(bits & Self::all().0)
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: u32) -> Self { Self(bits) }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                {
                    if name == "SPFlagZero" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagZero.bits()));
                    }
                };
                ;
                {
                    if name == "SPFlagVirtual" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagVirtual.bits()));
                    }
                };
                ;
                {
                    if name == "SPFlagPureVirtual" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagPureVirtual.bits()));
                    }
                };
                ;
                {
                    if name == "SPFlagLocalToUnit" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagLocalToUnit.bits()));
                    }
                };
                ;
                {
                    if name == "SPFlagDefinition" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagDefinition.bits()));
                    }
                };
                ;
                {
                    if name == "SPFlagOptimized" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagOptimized.bits()));
                    }
                };
                ;
                {
                    if name == "SPFlagMainSubprogram" {
                        return ::bitflags::__private::core::option::Option::Some(Self(DISPFlags::SPFlagMainSubprogram.bits()));
                    }
                };
                ;
                let _ = name;
                ::bitflags::__private::core::option::Option::None
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool {
                self.0 == <u32 as ::bitflags::Bits>::EMPTY
            }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool {
                Self::all().0 | self.0 == self.0
            }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0 & other.0 != <u32 as ::bitflags::Bits>::EMPTY
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0 & other.0 == other.0
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) {
                *self = Self(self.0).union(other);
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) {
                *self = Self(self.0).difference(other);
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) {
                *self = Self(self.0).symmetric_difference(other);
            }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                if value { self.insert(other); } else { self.remove(other); }
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0 & other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0 | other.0)
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0 & !other.0)
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0 ^ other.0)
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self::from_bits_truncate(!self.0)
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for InternalBitFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: InternalBitFlags) -> Self {
                self.union(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for InternalBitFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for
            InternalBitFlags {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for InternalBitFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for
            InternalBitFlags {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for InternalBitFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for InternalBitFlags
            {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for InternalBitFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<InternalBitFlags> for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<InternalBitFlags>
            for InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl InternalBitFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self) -> ::bitflags::iter::Iter<DISPFlags> {
                ::bitflags::iter::Iter::__private_const_new(<DISPFlags as
                        ::bitflags::Flags>::FLAGS,
                    DISPFlags::from_bits_retain(self.bits()),
                    DISPFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<DISPFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<DISPFlags as
                        ::bitflags::Flags>::FLAGS,
                    DISPFlags::from_bits_retain(self.bits()),
                    DISPFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for
            InternalBitFlags {
            type Item = DISPFlags;
            type IntoIter = ::bitflags::iter::Iter<DISPFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
        impl InternalBitFlags {
            /// Returns a mutable reference to the raw value of the flags currently stored.
            #[inline]
            pub fn bits_mut(&mut self) -> &mut u32 { &mut self.0 }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl DISPFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self { Self(InternalBitFlags::empty()) }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self { Self(InternalBitFlags::all()) }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> u32 { self.0.bits() }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: u32)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_bits(bits) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: u32) -> Self {
                Self(InternalBitFlags::from_bits_truncate(bits))
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: u32) -> Self {
                Self(InternalBitFlags::from_bits_retain(bits))
            }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_name(name) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool { self.0.is_empty() }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool { self.0.is_all() }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0.intersects(other.0)
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0.contains(other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) { self.0.insert(other.0) }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) { self.0.remove(other.0) }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) { self.0.toggle(other.0) }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                self.0.set(other.0, value)
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0.intersection(other.0))
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0.union(other.0))
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0.difference(other.0))
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0.symmetric_difference(other.0))
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self(self.0.complement())
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for DISPFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for DISPFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for DISPFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for DISPFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for DISPFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: DISPFlags) -> Self { self.union(other) }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for DISPFlags {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for DISPFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for DISPFlags {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for DISPFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for DISPFlags {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for DISPFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for DISPFlags {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for DISPFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<DISPFlags> for
            DISPFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<DISPFlags> for
            DISPFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl DISPFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self) -> ::bitflags::iter::Iter<DISPFlags> {
                ::bitflags::iter::Iter::__private_const_new(<DISPFlags as
                        ::bitflags::Flags>::FLAGS,
                    DISPFlags::from_bits_retain(self.bits()),
                    DISPFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<DISPFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<DISPFlags as
                        ::bitflags::Flags>::FLAGS,
                    DISPFlags::from_bits_retain(self.bits()),
                    DISPFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for DISPFlags {
            type Item = DISPFlags;
            type IntoIter = ::bitflags::iter::Iter<DISPFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
    };bitflags! {
815        #[repr(transparent)]
816        #[derive(Clone, Copy, Default)]
817        pub(crate) struct DISPFlags: u32 {
818            const SPFlagZero              = 0;
819            const SPFlagVirtual           = 1;
820            const SPFlagPureVirtual       = 2;
821            const SPFlagLocalToUnit       = (1 << 2);
822            const SPFlagDefinition        = (1 << 3);
823            const SPFlagOptimized         = (1 << 4);
824            const SPFlagMainSubprogram    = (1 << 5);
825        }
826    }
827
828    /// LLVMRustDebugEmissionKind
829    #[derive(#[automatically_derived]
impl ::core::marker::Copy for DebugEmissionKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DebugEmissionKind { }
#[automatically_derived]
impl ::core::clone::Clone for DebugEmissionKind {
    #[inline]
    fn clone(&self) -> DebugEmissionKind { *self }
}Clone)]
830    #[repr(C)]
831    pub(crate) enum DebugEmissionKind {
832        NoDebug,
833        FullDebug,
834        LineTablesOnly,
835        DebugDirectivesOnly,
836    }
837
838    /// LLVMRustDebugNameTableKind
839    #[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DebugNameTableKind { }
#[automatically_derived]
impl ::core::clone::Clone for DebugNameTableKind {
    #[inline]
    fn clone(&self) -> DebugNameTableKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for DebugNameTableKind { }Copy)]
840    #[repr(C)]
841    pub(crate) enum DebugNameTableKind {
842        Default,
843        #[expect(dead_code)]
844        Gnu,
845        None,
846    }
847}
848
849// These values **must** match with LLVMRustAllocKindFlags
850#[repr(transparent)]
pub(crate) struct AllocKindFlags(<AllocKindFlags as
    ::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]
impl ::core::default::Default for AllocKindFlags {
    #[inline]
    fn default() -> AllocKindFlags {
        AllocKindFlags(::core::default::Default::default())
    }
}
impl AllocKindFlags {
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Unknown: Self = Self::from_bits_retain(0);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Alloc: Self = Self::from_bits_retain(1);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Realloc: Self = Self::from_bits_retain(1 << 1);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Free: Self = Self::from_bits_retain(1 << 2);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Uninitialized: Self = Self::from_bits_retain(1 << 3);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Zeroed: Self = Self::from_bits_retain(1 << 4);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const Aligned: Self = Self::from_bits_retain(1 << 5);
}
impl ::bitflags::Flags for AllocKindFlags {
    const FLAGS: &'static [::bitflags::Flag<AllocKindFlags>] =
        &[{

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Unknown", AllocKindFlags::Unknown)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Alloc", AllocKindFlags::Alloc)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Realloc", AllocKindFlags::Realloc)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Free", AllocKindFlags::Free)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Uninitialized",
                            AllocKindFlags::Uninitialized)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Zeroed", AllocKindFlags::Zeroed)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("Aligned", AllocKindFlags::Aligned)
                    }];
    type Bits = u64;
    fn bits(&self) -> u64 { AllocKindFlags::bits(self) }
    fn from_bits_retain(bits: u64) -> AllocKindFlags {
        AllocKindFlags::from_bits_retain(bits)
    }
}
#[allow(dead_code, deprecated, unused_doc_comments, unused_attributes,
unused_mut, unused_imports, non_upper_case_globals, clippy ::
assign_op_pattern, clippy :: indexing_slicing, clippy :: same_name_method,
clippy :: iter_without_into_iter,)]
const _: () =
    {
        #[repr(transparent)]
        pub(crate) struct InternalBitFlags(u64);
        #[automatically_derived]
        #[doc(hidden)]
        unsafe impl ::core::clone::TrivialClone for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::clone::Clone for InternalBitFlags {
            #[inline]
            fn clone(&self) -> InternalBitFlags {
                let _: ::core::clone::AssertParamIsClone<u64>;
                *self
            }
        }
        #[automatically_derived]
        impl ::core::marker::Copy for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::marker::StructuralPartialEq for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::cmp::PartialEq for InternalBitFlags {
            #[inline]
            fn eq(&self, other: &InternalBitFlags) -> bool {
                self.0 == other.0
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Eq for InternalBitFlags {
            #[inline]
            #[doc(hidden)]
            #[coverage(off)]
            fn assert_fields_are_eq(&self) {
                let _: ::core::cmp::AssertParamIsEq<u64>;
            }
        }
        #[automatically_derived]
        impl ::core::cmp::PartialOrd for InternalBitFlags {
            #[inline]
            fn partial_cmp(&self, other: &InternalBitFlags)
                -> ::core::option::Option<::core::cmp::Ordering> {
                ::core::option::Option::Some(::core::cmp::Ord::cmp(self,
                        other))
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Ord for InternalBitFlags {
            #[inline]
            fn cmp(&self, other: &InternalBitFlags) -> ::core::cmp::Ordering {
                ::core::cmp::Ord::cmp(&self.0, &other.0)
            }
        }
        #[automatically_derived]
        impl ::core::hash::Hash for InternalBitFlags {
            #[inline]
            fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
                ::core::hash::Hash::hash(&self.0, state)
            }
        }
        impl ::bitflags::__private::PublicFlags for AllocKindFlags {
            type Primitive = u64;
            type Internal = InternalBitFlags;
        }
        impl ::bitflags::__private::core::default::Default for
            InternalBitFlags {
            #[inline]
            fn default() -> Self { InternalBitFlags::empty() }
        }
        impl ::bitflags::__private::core::fmt::Debug for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                if self.is_empty() {
                    f.write_fmt(format_args!("{0:#x}",
                            <u64 as ::bitflags::Bits>::EMPTY))
                } else {
                    ::bitflags::__private::core::fmt::Display::fmt(self, f)
                }
            }
        }
        impl ::bitflags::__private::core::fmt::Display for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                ::bitflags::parser::to_writer(&AllocKindFlags(*self), f)
            }
        }
        impl ::bitflags::__private::core::str::FromStr for InternalBitFlags {
            type Err = ::bitflags::parser::ParseError;
            fn from_str(s: &str)
                ->
                    ::bitflags::__private::core::result::Result<Self,
                    Self::Err> {
                ::bitflags::parser::from_str::<AllocKindFlags>(s).map(|flags|
                        flags.0)
            }
        }
        impl ::bitflags::__private::core::convert::AsRef<u64> for
            InternalBitFlags {
            fn as_ref(&self) -> &u64 { &self.0 }
        }
        impl ::bitflags::__private::core::convert::From<u64> for
            InternalBitFlags {
            fn from(bits: u64) -> Self { Self::from_bits_retain(bits) }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl InternalBitFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self {
                Self(<u64 as ::bitflags::Bits>::EMPTY)
            }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self {
                let mut truncated = <u64 as ::bitflags::Bits>::EMPTY;
                let mut i = 0;
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <AllocKindFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                let _ = i;
                Self(truncated)
            }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> u64 { self.0 }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: u64)
                -> ::bitflags::__private::core::option::Option<Self> {
                let truncated = Self::from_bits_truncate(bits).0;
                if truncated == bits {
                    ::bitflags::__private::core::option::Option::Some(Self(bits))
                } else { ::bitflags::__private::core::option::Option::None }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: u64) -> Self {
                Self(bits & Self::all().0)
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: u64) -> Self { Self(bits) }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                {
                    if name == "Unknown" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Unknown.bits()));
                    }
                };
                ;
                {
                    if name == "Alloc" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Alloc.bits()));
                    }
                };
                ;
                {
                    if name == "Realloc" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Realloc.bits()));
                    }
                };
                ;
                {
                    if name == "Free" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Free.bits()));
                    }
                };
                ;
                {
                    if name == "Uninitialized" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Uninitialized.bits()));
                    }
                };
                ;
                {
                    if name == "Zeroed" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Zeroed.bits()));
                    }
                };
                ;
                {
                    if name == "Aligned" {
                        return ::bitflags::__private::core::option::Option::Some(Self(AllocKindFlags::Aligned.bits()));
                    }
                };
                ;
                let _ = name;
                ::bitflags::__private::core::option::Option::None
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool {
                self.0 == <u64 as ::bitflags::Bits>::EMPTY
            }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool {
                Self::all().0 | self.0 == self.0
            }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0 & other.0 != <u64 as ::bitflags::Bits>::EMPTY
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0 & other.0 == other.0
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) {
                *self = Self(self.0).union(other);
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) {
                *self = Self(self.0).difference(other);
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) {
                *self = Self(self.0).symmetric_difference(other);
            }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                if value { self.insert(other); } else { self.remove(other); }
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0 & other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0 | other.0)
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0 & !other.0)
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0 ^ other.0)
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self::from_bits_truncate(!self.0)
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for InternalBitFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: InternalBitFlags) -> Self {
                self.union(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for InternalBitFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for
            InternalBitFlags {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for InternalBitFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for
            InternalBitFlags {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for InternalBitFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for InternalBitFlags
            {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for InternalBitFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<InternalBitFlags> for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<InternalBitFlags>
            for InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl InternalBitFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self)
                -> ::bitflags::iter::Iter<AllocKindFlags> {
                ::bitflags::iter::Iter::__private_const_new(<AllocKindFlags as
                        ::bitflags::Flags>::FLAGS,
                    AllocKindFlags::from_bits_retain(self.bits()),
                    AllocKindFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<AllocKindFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<AllocKindFlags
                        as ::bitflags::Flags>::FLAGS,
                    AllocKindFlags::from_bits_retain(self.bits()),
                    AllocKindFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for
            InternalBitFlags {
            type Item = AllocKindFlags;
            type IntoIter = ::bitflags::iter::Iter<AllocKindFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
        impl InternalBitFlags {
            /// Returns a mutable reference to the raw value of the flags currently stored.
            #[inline]
            pub fn bits_mut(&mut self) -> &mut u64 { &mut self.0 }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl AllocKindFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self { Self(InternalBitFlags::empty()) }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self { Self(InternalBitFlags::all()) }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> u64 { self.0.bits() }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: u64)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_bits(bits) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: u64) -> Self {
                Self(InternalBitFlags::from_bits_truncate(bits))
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: u64) -> Self {
                Self(InternalBitFlags::from_bits_retain(bits))
            }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_name(name) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool { self.0.is_empty() }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool { self.0.is_all() }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0.intersects(other.0)
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0.contains(other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) { self.0.insert(other.0) }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) { self.0.remove(other.0) }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) { self.0.toggle(other.0) }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                self.0.set(other.0, value)
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0.intersection(other.0))
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0.union(other.0))
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0.difference(other.0))
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0.symmetric_difference(other.0))
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self(self.0.complement())
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for AllocKindFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for AllocKindFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for AllocKindFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for AllocKindFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for AllocKindFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: AllocKindFlags) -> Self {
                self.union(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for AllocKindFlags
            {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for AllocKindFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for AllocKindFlags
            {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for AllocKindFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for AllocKindFlags
            {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for AllocKindFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for AllocKindFlags {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for AllocKindFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<AllocKindFlags> for
            AllocKindFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<AllocKindFlags>
            for AllocKindFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl AllocKindFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self)
                -> ::bitflags::iter::Iter<AllocKindFlags> {
                ::bitflags::iter::Iter::__private_const_new(<AllocKindFlags as
                        ::bitflags::Flags>::FLAGS,
                    AllocKindFlags::from_bits_retain(self.bits()),
                    AllocKindFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<AllocKindFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<AllocKindFlags
                        as ::bitflags::Flags>::FLAGS,
                    AllocKindFlags::from_bits_retain(self.bits()),
                    AllocKindFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for
            AllocKindFlags {
            type Item = AllocKindFlags;
            type IntoIter = ::bitflags::iter::Iter<AllocKindFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
    };bitflags! {
851    #[repr(transparent)]
852    #[derive(Default)]
853    pub(crate) struct AllocKindFlags : u64 {
854        const Unknown = 0;
855        const Alloc = 1;
856        const Realloc = 1 << 1;
857        const Free = 1 << 2;
858        const Uninitialized = 1 << 3;
859        const Zeroed = 1 << 4;
860        const Aligned = 1 << 5;
861    }
862}
863
864// These values **must** match with LLVMGEPNoWrapFlags
865#[repr(transparent)]
pub struct GEPNoWrapFlags(<GEPNoWrapFlags as
    ::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]
impl ::core::default::Default for GEPNoWrapFlags {
    #[inline]
    fn default() -> GEPNoWrapFlags {
        GEPNoWrapFlags(::core::default::Default::default())
    }
}
impl GEPNoWrapFlags {
    #[allow(deprecated, non_upper_case_globals,)]
    pub const InBounds: Self = Self::from_bits_retain(1 << 0);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const NUSW: Self = Self::from_bits_retain(1 << 1);
    #[allow(deprecated, non_upper_case_globals,)]
    pub const NUW: Self = Self::from_bits_retain(1 << 2);
}
impl ::bitflags::Flags for GEPNoWrapFlags {
    const FLAGS: &'static [::bitflags::Flag<GEPNoWrapFlags>] =
        &[{

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("InBounds", GEPNoWrapFlags::InBounds)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("NUSW", GEPNoWrapFlags::NUSW)
                    },
                    {

                        #[allow(deprecated, non_upper_case_globals,)]
                        ::bitflags::Flag::new("NUW", GEPNoWrapFlags::NUW)
                    }];
    type Bits = c_uint;
    fn bits(&self) -> c_uint { GEPNoWrapFlags::bits(self) }
    fn from_bits_retain(bits: c_uint) -> GEPNoWrapFlags {
        GEPNoWrapFlags::from_bits_retain(bits)
    }
}
#[allow(dead_code, deprecated, unused_doc_comments, unused_attributes,
unused_mut, unused_imports, non_upper_case_globals, clippy ::
assign_op_pattern, clippy :: indexing_slicing, clippy :: same_name_method,
clippy :: iter_without_into_iter,)]
const _: () =
    {
        #[repr(transparent)]
        pub struct InternalBitFlags(c_uint);
        #[automatically_derived]
        #[doc(hidden)]
        unsafe impl ::core::clone::TrivialClone for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::clone::Clone for InternalBitFlags {
            #[inline]
            fn clone(&self) -> InternalBitFlags {
                let _: ::core::clone::AssertParamIsClone<c_uint>;
                *self
            }
        }
        #[automatically_derived]
        impl ::core::marker::Copy for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::marker::StructuralPartialEq for InternalBitFlags { }
        #[automatically_derived]
        impl ::core::cmp::PartialEq for InternalBitFlags {
            #[inline]
            fn eq(&self, other: &InternalBitFlags) -> bool {
                self.0 == other.0
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Eq for InternalBitFlags {
            #[inline]
            #[doc(hidden)]
            #[coverage(off)]
            fn assert_fields_are_eq(&self) {
                let _: ::core::cmp::AssertParamIsEq<c_uint>;
            }
        }
        #[automatically_derived]
        impl ::core::cmp::PartialOrd for InternalBitFlags {
            #[inline]
            fn partial_cmp(&self, other: &InternalBitFlags)
                -> ::core::option::Option<::core::cmp::Ordering> {
                ::core::option::Option::Some(::core::cmp::Ord::cmp(self,
                        other))
            }
        }
        #[automatically_derived]
        impl ::core::cmp::Ord for InternalBitFlags {
            #[inline]
            fn cmp(&self, other: &InternalBitFlags) -> ::core::cmp::Ordering {
                ::core::cmp::Ord::cmp(&self.0, &other.0)
            }
        }
        #[automatically_derived]
        impl ::core::hash::Hash for InternalBitFlags {
            #[inline]
            fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
                ::core::hash::Hash::hash(&self.0, state)
            }
        }
        impl ::bitflags::__private::PublicFlags for GEPNoWrapFlags {
            type Primitive = c_uint;
            type Internal = InternalBitFlags;
        }
        impl ::bitflags::__private::core::default::Default for
            InternalBitFlags {
            #[inline]
            fn default() -> Self { InternalBitFlags::empty() }
        }
        impl ::bitflags::__private::core::fmt::Debug for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                if self.is_empty() {
                    f.write_fmt(format_args!("{0:#x}",
                            <c_uint as ::bitflags::Bits>::EMPTY))
                } else {
                    ::bitflags::__private::core::fmt::Display::fmt(self, f)
                }
            }
        }
        impl ::bitflags::__private::core::fmt::Display for InternalBitFlags {
            fn fmt(&self,
                f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
                -> ::bitflags::__private::core::fmt::Result {
                ::bitflags::parser::to_writer(&GEPNoWrapFlags(*self), f)
            }
        }
        impl ::bitflags::__private::core::str::FromStr for InternalBitFlags {
            type Err = ::bitflags::parser::ParseError;
            fn from_str(s: &str)
                ->
                    ::bitflags::__private::core::result::Result<Self,
                    Self::Err> {
                ::bitflags::parser::from_str::<GEPNoWrapFlags>(s).map(|flags|
                        flags.0)
            }
        }
        impl ::bitflags::__private::core::convert::AsRef<c_uint> for
            InternalBitFlags {
            fn as_ref(&self) -> &c_uint { &self.0 }
        }
        impl ::bitflags::__private::core::convert::From<c_uint> for
            InternalBitFlags {
            fn from(bits: c_uint) -> Self { Self::from_bits_retain(bits) }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl InternalBitFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self {
                Self(<c_uint as ::bitflags::Bits>::EMPTY)
            }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self {
                let mut truncated = <c_uint as ::bitflags::Bits>::EMPTY;
                let mut i = 0;
                {
                    {
                        let flag =
                            <GEPNoWrapFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <GEPNoWrapFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                {
                    {
                        let flag =
                            <GEPNoWrapFlags as
                                            ::bitflags::Flags>::FLAGS[i].value().bits();
                        truncated = truncated | flag;
                        i += 1;
                    }
                };
                let _ = i;
                Self(truncated)
            }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> c_uint { self.0 }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: c_uint)
                -> ::bitflags::__private::core::option::Option<Self> {
                let truncated = Self::from_bits_truncate(bits).0;
                if truncated == bits {
                    ::bitflags::__private::core::option::Option::Some(Self(bits))
                } else { ::bitflags::__private::core::option::Option::None }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: c_uint) -> Self {
                Self(bits & Self::all().0)
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: c_uint) -> Self { Self(bits) }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                {
                    if name == "InBounds" {
                        return ::bitflags::__private::core::option::Option::Some(Self(GEPNoWrapFlags::InBounds.bits()));
                    }
                };
                ;
                {
                    if name == "NUSW" {
                        return ::bitflags::__private::core::option::Option::Some(Self(GEPNoWrapFlags::NUSW.bits()));
                    }
                };
                ;
                {
                    if name == "NUW" {
                        return ::bitflags::__private::core::option::Option::Some(Self(GEPNoWrapFlags::NUW.bits()));
                    }
                };
                ;
                let _ = name;
                ::bitflags::__private::core::option::Option::None
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool {
                self.0 == <c_uint as ::bitflags::Bits>::EMPTY
            }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool {
                Self::all().0 | self.0 == self.0
            }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0 & other.0 != <c_uint as ::bitflags::Bits>::EMPTY
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0 & other.0 == other.0
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) {
                *self = Self(self.0).union(other);
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) {
                *self = Self(self.0).difference(other);
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) {
                *self = Self(self.0).symmetric_difference(other);
            }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                if value { self.insert(other); } else { self.remove(other); }
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0 & other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0 | other.0)
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0 & !other.0)
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0 ^ other.0)
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self::from_bits_truncate(!self.0)
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for InternalBitFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for InternalBitFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: InternalBitFlags) -> Self {
                self.union(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for InternalBitFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for
            InternalBitFlags {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for InternalBitFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for
            InternalBitFlags {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for InternalBitFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for InternalBitFlags
            {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for InternalBitFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<InternalBitFlags> for
            InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<InternalBitFlags>
            for InternalBitFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl InternalBitFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self)
                -> ::bitflags::iter::Iter<GEPNoWrapFlags> {
                ::bitflags::iter::Iter::__private_const_new(<GEPNoWrapFlags as
                        ::bitflags::Flags>::FLAGS,
                    GEPNoWrapFlags::from_bits_retain(self.bits()),
                    GEPNoWrapFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<GEPNoWrapFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<GEPNoWrapFlags
                        as ::bitflags::Flags>::FLAGS,
                    GEPNoWrapFlags::from_bits_retain(self.bits()),
                    GEPNoWrapFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for
            InternalBitFlags {
            type Item = GEPNoWrapFlags;
            type IntoIter = ::bitflags::iter::Iter<GEPNoWrapFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
        impl InternalBitFlags {
            /// Returns a mutable reference to the raw value of the flags currently stored.
            #[inline]
            pub fn bits_mut(&mut self) -> &mut c_uint { &mut self.0 }
        }
        #[allow(dead_code, deprecated, unused_attributes)]
        impl GEPNoWrapFlags {
            /// Get a flags value with all bits unset.
            #[inline]
            pub const fn empty() -> Self { Self(InternalBitFlags::empty()) }
            /// Get a flags value with all known bits set.
            #[inline]
            pub const fn all() -> Self { Self(InternalBitFlags::all()) }
            /// Get the underlying bits value.
            ///
            /// The returned value is exactly the bits set in this flags value.
            #[inline]
            pub const fn bits(&self) -> c_uint { self.0.bits() }
            /// Convert from a bits value.
            ///
            /// This method will return `None` if any unknown bits are set.
            #[inline]
            pub const fn from_bits(bits: c_uint)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_bits(bits) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Convert from a bits value, unsetting any unknown bits.
            #[inline]
            pub const fn from_bits_truncate(bits: c_uint) -> Self {
                Self(InternalBitFlags::from_bits_truncate(bits))
            }
            /// Convert from a bits value exactly.
            #[inline]
            pub const fn from_bits_retain(bits: c_uint) -> Self {
                Self(InternalBitFlags::from_bits_retain(bits))
            }
            /// Get a flags value with the bits of a flag with the given name set.
            ///
            /// This method will return `None` if `name` is empty or doesn't
            /// correspond to any named flag.
            #[inline]
            pub fn from_name(name: &str)
                -> ::bitflags::__private::core::option::Option<Self> {
                match InternalBitFlags::from_name(name) {
                    ::bitflags::__private::core::option::Option::Some(bits) =>
                        ::bitflags::__private::core::option::Option::Some(Self(bits)),
                    ::bitflags::__private::core::option::Option::None =>
                        ::bitflags::__private::core::option::Option::None,
                }
            }
            /// Whether all bits in this flags value are unset.
            #[inline]
            pub const fn is_empty(&self) -> bool { self.0.is_empty() }
            /// Whether all known bits in this flags value are set.
            #[inline]
            pub const fn is_all(&self) -> bool { self.0.is_all() }
            /// Whether any set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn intersects(&self, other: Self) -> bool {
                self.0.intersects(other.0)
            }
            /// Whether all set bits in a source flags value are also set in a target flags value.
            #[inline]
            pub const fn contains(&self, other: Self) -> bool {
                self.0.contains(other.0)
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            pub fn insert(&mut self, other: Self) { self.0.insert(other.0) }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `remove` won't truncate `other`, but the `!` operator will.
            #[inline]
            pub fn remove(&mut self, other: Self) { self.0.remove(other.0) }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            pub fn toggle(&mut self, other: Self) { self.0.toggle(other.0) }
            /// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
            #[inline]
            pub fn set(&mut self, other: Self, value: bool) {
                self.0.set(other.0, value)
            }
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn intersection(self, other: Self) -> Self {
                Self(self.0.intersection(other.0))
            }
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn union(self, other: Self) -> Self {
                Self(self.0.union(other.0))
            }
            /// The intersection of a source flags value with the complement of a target flags
            /// value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            #[must_use]
            pub const fn difference(self, other: Self) -> Self {
                Self(self.0.difference(other.0))
            }
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            #[must_use]
            pub const fn symmetric_difference(self, other: Self) -> Self {
                Self(self.0.symmetric_difference(other.0))
            }
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            #[must_use]
            pub const fn complement(self) -> Self {
                Self(self.0.complement())
            }
        }
        impl ::bitflags::__private::core::fmt::Binary for GEPNoWrapFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::Octal for GEPNoWrapFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::LowerHex for GEPNoWrapFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::fmt::UpperHex for GEPNoWrapFlags {
            fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
                -> ::bitflags::__private::core::fmt::Result {
                let inner = self.0;
                ::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
            }
        }
        impl ::bitflags::__private::core::ops::BitOr for GEPNoWrapFlags {
            type Output = Self;
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor(self, other: GEPNoWrapFlags) -> Self {
                self.union(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitOrAssign for GEPNoWrapFlags
            {
            /// The bitwise or (`|`) of the bits in two flags values.
            #[inline]
            fn bitor_assign(&mut self, other: Self) { self.insert(other); }
        }
        impl ::bitflags::__private::core::ops::BitXor for GEPNoWrapFlags {
            type Output = Self;
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor(self, other: Self) -> Self {
                self.symmetric_difference(other)
            }
        }
        impl ::bitflags::__private::core::ops::BitXorAssign for GEPNoWrapFlags
            {
            /// The bitwise exclusive-or (`^`) of the bits in two flags values.
            #[inline]
            fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
        }
        impl ::bitflags::__private::core::ops::BitAnd for GEPNoWrapFlags {
            type Output = Self;
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand(self, other: Self) -> Self { self.intersection(other) }
        }
        impl ::bitflags::__private::core::ops::BitAndAssign for GEPNoWrapFlags
            {
            /// The bitwise and (`&`) of the bits in two flags values.
            #[inline]
            fn bitand_assign(&mut self, other: Self) {
                *self =
                    Self::from_bits_retain(self.bits()).intersection(other);
            }
        }
        impl ::bitflags::__private::core::ops::Sub for GEPNoWrapFlags {
            type Output = Self;
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub(self, other: Self) -> Self { self.difference(other) }
        }
        impl ::bitflags::__private::core::ops::SubAssign for GEPNoWrapFlags {
            /// The intersection of a source flags value with the complement of a target flags value (`&!`).
            ///
            /// This method is not equivalent to `self & !other` when `other` has unknown bits set.
            /// `difference` won't truncate `other`, but the `!` operator will.
            #[inline]
            fn sub_assign(&mut self, other: Self) { self.remove(other); }
        }
        impl ::bitflags::__private::core::ops::Not for GEPNoWrapFlags {
            type Output = Self;
            /// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
            #[inline]
            fn not(self) -> Self { self.complement() }
        }
        impl ::bitflags::__private::core::iter::Extend<GEPNoWrapFlags> for
            GEPNoWrapFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(&mut self, iterator: T) {
                for item in iterator { self.insert(item) }
            }
        }
        impl ::bitflags::__private::core::iter::FromIterator<GEPNoWrapFlags>
            for GEPNoWrapFlags {
            /// The bitwise or (`|`) of the bits in each flags value.
            fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
                = Self>>(iterator: T) -> Self {
                use ::bitflags::__private::core::iter::Extend;
                let mut result = Self::empty();
                result.extend(iterator);
                result
            }
        }
        impl GEPNoWrapFlags {
            /// Yield a set of contained flags values.
            ///
            /// Each yielded flags value will correspond to a defined named flag. Any unknown bits
            /// will be yielded together as a final flags value.
            #[inline]
            pub const fn iter(&self)
                -> ::bitflags::iter::Iter<GEPNoWrapFlags> {
                ::bitflags::iter::Iter::__private_const_new(<GEPNoWrapFlags as
                        ::bitflags::Flags>::FLAGS,
                    GEPNoWrapFlags::from_bits_retain(self.bits()),
                    GEPNoWrapFlags::from_bits_retain(self.bits()))
            }
            /// Yield a set of contained named flags values.
            ///
            /// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
            /// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
            #[inline]
            pub const fn iter_names(&self)
                -> ::bitflags::iter::IterNames<GEPNoWrapFlags> {
                ::bitflags::iter::IterNames::__private_const_new(<GEPNoWrapFlags
                        as ::bitflags::Flags>::FLAGS,
                    GEPNoWrapFlags::from_bits_retain(self.bits()),
                    GEPNoWrapFlags::from_bits_retain(self.bits()))
            }
        }
        impl ::bitflags::__private::core::iter::IntoIterator for
            GEPNoWrapFlags {
            type Item = GEPNoWrapFlags;
            type IntoIter = ::bitflags::iter::Iter<GEPNoWrapFlags>;
            fn into_iter(self) -> Self::IntoIter { self.iter() }
        }
    };bitflags! {
866    #[repr(transparent)]
867    #[derive(Default)]
868    pub struct GEPNoWrapFlags : c_uint {
869        const InBounds = 1 << 0;
870        const NUSW = 1 << 1;
871        const NUW = 1 << 2;
872    }
873}
874
875unsafe extern "C" {
876    pub(crate) type Buffer;
877}
878
879pub(crate) type SelfProfileBeforePassCallback =
880    unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
881pub(crate) type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
882
883pub(crate) type GetSymbolsCallback =
884    unsafe extern "C" fn(*mut c_void, *const c_char) -> *mut c_void;
885pub(crate) type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) -> *mut c_void;
886
887unsafe extern "C" {
888    // Create and destroy contexts.
889    pub(crate) fn LLVMContextCreate() -> &'static mut Context;
890    pub(crate) fn LLVMContextDispose(C: &'static mut Context);
891    pub(crate) fn LLVMContextSetDiscardValueNames(C: &Context, Discard: Bool);
892    pub(crate) fn LLVMGetMDKindIDInContext(
893        C: &Context,
894        Name: *const c_char,
895        SLen: c_uint,
896    ) -> MetadataKindId;
897
898    /// Gets the actual version of LLVM that we are linked to at runtime.
899    ///
900    /// # Safety
901    /// Can be called without initializing LLVM.
902    pub(crate) safe fn LLVMGetVersion(major: &mut c_uint, minor: &mut c_uint, patch: &mut c_uint);
903
904    pub(crate) fn LLVMDisposeTargetMachine(T: ptr::NonNull<TargetMachine>);
905
906    // Create modules.
907    pub(crate) fn LLVMModuleCreateWithNameInContext(
908        ModuleID: *const c_char,
909        C: &Context,
910    ) -> &Module;
911    pub(crate) safe fn LLVMCloneModule(M: &Module) -> &Module;
912
913    /// Data layout. See Module::getDataLayout.
914    pub(crate) fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
915    pub(crate) fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
916
917    /// Create the specified uniqued inline asm string. See `InlineAsm::get()`.
918    pub(crate) fn LLVMGetInlineAsm<'ll>(
919        Ty: &'ll Type,
920        AsmString: *const c_uchar, // See "PTR_LEN_STR".
921        AsmStringSize: size_t,
922        Constraints: *const c_uchar, // See "PTR_LEN_STR".
923        ConstraintsSize: size_t,
924        HasSideEffects: llvm::Bool,
925        IsAlignStack: llvm::Bool,
926        Dialect: AsmDialect,
927        CanThrow: llvm::Bool,
928    ) -> &'ll Value;
929
930    pub(crate) safe fn LLVMGetTypeKind(Ty: &Type) -> RawEnum<TypeKind>;
931
932    // Operations on integer types
933    pub(crate) fn LLVMInt1TypeInContext(C: &Context) -> &Type;
934    pub(crate) fn LLVMInt8TypeInContext(C: &Context) -> &Type;
935    pub(crate) fn LLVMInt16TypeInContext(C: &Context) -> &Type;
936    pub(crate) fn LLVMInt32TypeInContext(C: &Context) -> &Type;
937    pub(crate) fn LLVMInt64TypeInContext(C: &Context) -> &Type;
938    pub(crate) safe fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
939
940    pub(crate) fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
941
942    // Operations on real types
943    pub(crate) fn LLVMHalfTypeInContext(C: &Context) -> &Type;
944    pub(crate) fn LLVMFloatTypeInContext(C: &Context) -> &Type;
945    pub(crate) fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
946    pub(crate) fn LLVMFP128TypeInContext(C: &Context) -> &Type;
947
948    // Operations on non-IEEE real types
949    pub(crate) fn LLVMBFloatTypeInContext(C: &Context) -> &Type;
950
951    // Operations on function types
952    pub(crate) fn LLVMFunctionType<'a>(
953        ReturnType: &'a Type,
954        ParamTypes: *const &'a Type,
955        ParamCount: c_uint,
956        IsVarArg: Bool,
957    ) -> &'a Type;
958    pub(crate) fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
959    pub(crate) fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
960    pub(crate) fn LLVMGetReturnType(FunctionTy: &Type) -> &Type;
961    pub(crate) fn LLVMIsFunctionVarArg(FunctionTy: &Type) -> Bool;
962
963    // Operations on struct types
964    pub(crate) fn LLVMStructTypeInContext<'a>(
965        C: &'a Context,
966        ElementTypes: *const &'a Type,
967        ElementCount: c_uint,
968        Packed: Bool,
969    ) -> &'a Type;
970
971    // Operations on array, pointer, and vector types (sequence types)
972    pub(crate) safe fn LLVMPointerTypeInContext(C: &Context, AddressSpace: c_uint) -> &Type;
973    pub(crate) fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
974    pub(crate) fn LLVMScalableVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
975
976    pub(crate) fn LLVMGetElementType(Ty: &Type) -> &Type;
977    pub(crate) fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
978
979    // Operations on other types
980    pub(crate) fn LLVMVoidTypeInContext(C: &Context) -> &Type;
981
982    // Operations on all values
983    pub(crate) fn LLVMTypeOf(Val: &Value) -> &Type;
984    pub(crate) fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
985    pub(crate) fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
986    pub(crate) fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
987    pub(crate) safe fn LLVMGetMetadata<'a>(
988        Val: &'a Value,
989        KindID: MetadataKindId,
990    ) -> Option<&'a Value>;
991    pub(crate) safe fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: MetadataKindId, Node: &'a Value);
992    pub(crate) fn LLVMGlobalSetMetadata<'a>(
993        Val: &'a Value,
994        KindID: MetadataKindId,
995        Metadata: &'a Metadata,
996    );
997    pub(crate) safe fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
998
999    // Operations on constants of any type
1000    pub(crate) fn LLVMConstNull(Ty: &Type) -> &Value;
1001    pub(crate) fn LLVMGetUndef(Ty: &Type) -> &Value;
1002    pub(crate) fn LLVMGetPoison(Ty: &Type) -> &Value;
1003
1004    // Operations on metadata
1005    pub(crate) fn LLVMMDStringInContext2(
1006        C: &Context,
1007        Str: *const c_char,
1008        SLen: size_t,
1009    ) -> &Metadata;
1010    pub(crate) fn LLVMMDNodeInContext2<'a>(
1011        C: &'a Context,
1012        Vals: *const &'a Metadata,
1013        Count: size_t,
1014    ) -> &'a Metadata;
1015    pub(crate) fn LLVMAddNamedMetadataOperand<'a>(
1016        M: &'a Module,
1017        Name: *const c_char,
1018        Val: &'a Value,
1019    );
1020    pub(crate) fn LLVMReplaceMDNodeOperandWith(Val: &Value, index: u32, replacement: &Metadata);
1021
1022    // Operations on scalar constants
1023    pub(crate) fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1024    pub(crate) fn LLVMConstIntOfArbitraryPrecision(
1025        IntTy: &Type,
1026        Wn: c_uint,
1027        Ws: *const u64,
1028    ) -> &Value;
1029    pub(crate) fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1030
1031    // Operations on composite constants
1032    pub(crate) fn LLVMConstArray2<'a>(
1033        ElementTy: &'a Type,
1034        ConstantVals: *const &'a Value,
1035        Length: u64,
1036    ) -> &'a Value;
1037    pub(crate) fn LLVMArrayType2(ElementType: &Type, ElementCount: u64) -> &Type;
1038    pub(crate) fn LLVMConstStringInContext2(
1039        C: &Context,
1040        Str: *const c_char,
1041        Length: size_t,
1042        DontNullTerminate: Bool,
1043    ) -> &Value;
1044    pub(crate) fn LLVMConstStructInContext<'a>(
1045        C: &'a Context,
1046        ConstantVals: *const &'a Value,
1047        Count: c_uint,
1048        Packed: Bool,
1049    ) -> &'a Value;
1050    pub(crate) fn LLVMConstNamedStruct<'a>(
1051        StructTy: &'a Type,
1052        ConstantVals: *const &'a Value,
1053        Count: c_uint,
1054    ) -> &'a Value;
1055    pub(crate) fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1056
1057    // Constant expressions
1058    pub(crate) fn LLVMConstInBoundsGEP2<'a>(
1059        ty: &'a Type,
1060        ConstantVal: &'a Value,
1061        ConstantIndices: *const &'a Value,
1062        NumIndices: c_uint,
1063    ) -> &'a Value;
1064    pub(crate) fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1065    pub(crate) fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1066    pub(crate) fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1067    pub(crate) fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1068    pub(crate) fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1069    pub(crate) fn LLVMGetConstOpcode(ConstantVal: &Value) -> Opcode;
1070    pub(crate) fn LLVMIsAConstantExpr(Val: &Value) -> Option<&Value>;
1071
1072    // Operations on global variables, functions, and aliases (globals)
1073    pub(crate) fn LLVMIsDeclaration(Global: &Value) -> Bool;
1074    pub(crate) fn LLVMGetLinkage(Global: &Value) -> RawEnum<Linkage>;
1075    pub(crate) fn LLVMSetLinkage(Global: &Value, RustLinkage: Linkage);
1076    pub(crate) fn LLVMSetSection(Global: &Value, Section: *const c_char);
1077    pub(crate) fn LLVMGetVisibility(Global: &Value) -> RawEnum<Visibility>;
1078    pub(crate) fn LLVMSetVisibility(Global: &Value, Viz: Visibility);
1079    pub(crate) fn LLVMGetAlignment(Global: &Value) -> c_uint;
1080    pub(crate) fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1081    pub(crate) fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1082    pub(crate) fn LLVMGlobalGetValueType(Global: &Value) -> &Type;
1083
1084    // Operations on global variables
1085    pub(crate) safe fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1086    pub(crate) fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1087    pub(crate) fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1088    pub(crate) fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1089    pub(crate) fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1090    pub(crate) fn LLVMDeleteGlobal(GlobalVar: &Value);
1091    pub(crate) safe fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1092    pub(crate) fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1093    pub(crate) safe fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1094    pub(crate) fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1095    pub(crate) safe fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1096    pub(crate) safe fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1097    pub(crate) safe fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1098    pub(crate) safe fn LLVMSetTailCallKind(CallInst: &Value, kind: TailCallKind);
1099    pub(crate) safe fn LLVMSetExternallyInitialized(GlobalVar: &Value, IsExtInit: Bool);
1100
1101    // Operations on global aliases
1102    pub(crate) fn LLVMAddAlias2<'ll>(
1103        M: &'ll Module,
1104        ValueTy: &Type,
1105        AddressSpace: c_uint,
1106        Aliasee: &Value,
1107        Name: *const c_char,
1108    ) -> &'ll Value;
1109    pub(crate) fn LLVMGetFirstGlobalAlias(M: &Module) -> Option<&Value>;
1110    pub(crate) fn LLVMGetNextGlobalAlias(GlobalAlias: &Value) -> Option<&Value>;
1111
1112    // Operations on attributes
1113    pub(crate) fn LLVMCreateStringAttribute(
1114        C: &Context,
1115        Name: *const c_char,
1116        NameLen: c_uint,
1117        Value: *const c_char,
1118        ValueLen: c_uint,
1119    ) -> &Attribute;
1120
1121    // Operations on functions
1122    pub(crate) fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1123    pub(crate) fn LLVMAddFunction<'a>(
1124        Mod: &'a Module,
1125        Name: *const c_char,
1126        FunctionTy: &'a Type,
1127    ) -> &'a Value;
1128    pub(crate) fn LLVMDeleteFunction(Fn: &Value);
1129
1130    // Operations about llvm intrinsics
1131    pub(crate) fn LLVMLookupIntrinsicID(Name: *const c_char, NameLen: size_t) -> c_uint;
1132    pub(crate) fn LLVMIntrinsicIsOverloaded(ID: NonZero<c_uint>) -> Bool;
1133    pub(crate) fn LLVMGetIntrinsicDeclaration<'a>(
1134        Mod: &'a Module,
1135        ID: NonZero<c_uint>,
1136        ParamTypes: *const &'a Type,
1137        ParamCount: size_t,
1138    ) -> &'a Value;
1139    pub(crate) fn LLVMRustUpgradeIntrinsicFunction<'a>(
1140        Fn: &'a Value,
1141        NewFn: &mut Option<&'a Value>,
1142    ) -> bool;
1143    pub(crate) fn LLVMRustIsTargetIntrinsic(ID: NonZero<c_uint>) -> bool;
1144
1145    // Operations on parameters
1146    pub(crate) fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1147    pub(crate) safe fn LLVMCountParams(Fn: &Value) -> c_uint;
1148    pub(crate) fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1149
1150    // Operations on basic blocks
1151    pub(crate) fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1152    pub(crate) fn LLVMAppendBasicBlockInContext<'a>(
1153        C: &'a Context,
1154        Fn: &'a Value,
1155        Name: *const c_char,
1156    ) -> &'a BasicBlock;
1157
1158    // Operations on instructions
1159    pub(crate) fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1160    pub(crate) fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1161    pub(crate) fn LLVMGetOperand(Val: &Value, Index: c_uint) -> Option<&Value>;
1162
1163    // Operations on call sites
1164    pub(crate) fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1165
1166    // Operations on load/store instructions (only)
1167    pub(crate) fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1168    pub(crate) fn LLVMSetOrdering(MemoryAccessInst: &Value, Ordering: AtomicOrdering);
1169
1170    // Operations on phi nodes
1171    pub(crate) fn LLVMAddIncoming<'a>(
1172        PhiNode: &'a Value,
1173        IncomingValues: *const &'a Value,
1174        IncomingBlocks: *const &'a BasicBlock,
1175        Count: c_uint,
1176    );
1177
1178    // Instruction builders
1179    pub(crate) fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1180    pub(crate) fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1181    pub(crate) fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1182    pub(crate) fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1183
1184    // Metadata
1185    pub(crate) fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: *const Metadata);
1186    pub(crate) fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>;
1187
1188    // Terminators
1189    pub(crate) safe fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1190    pub(crate) fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1191    pub(crate) fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1192    pub(crate) fn LLVMBuildCondBr<'a>(
1193        B: &Builder<'a>,
1194        If: &'a Value,
1195        Then: &'a BasicBlock,
1196        Else: &'a BasicBlock,
1197    ) -> &'a Value;
1198    pub(crate) fn LLVMBuildSwitch<'a>(
1199        B: &Builder<'a>,
1200        V: &'a Value,
1201        Else: &'a BasicBlock,
1202        NumCases: c_uint,
1203    ) -> &'a Value;
1204    pub(crate) fn LLVMBuildLandingPad<'a>(
1205        B: &Builder<'a>,
1206        Ty: &'a Type,
1207        PersFn: Option<&'a Value>,
1208        NumClauses: c_uint,
1209        Name: *const c_char,
1210    ) -> &'a Value;
1211    pub(crate) fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1212    pub(crate) fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1213
1214    pub(crate) fn LLVMBuildCleanupPad<'a>(
1215        B: &Builder<'a>,
1216        ParentPad: Option<&'a Value>,
1217        Args: *const &'a Value,
1218        NumArgs: c_uint,
1219        Name: *const c_char,
1220    ) -> Option<&'a Value>;
1221    pub(crate) fn LLVMBuildCleanupRet<'a>(
1222        B: &Builder<'a>,
1223        CleanupPad: &'a Value,
1224        BB: Option<&'a BasicBlock>,
1225    ) -> Option<&'a Value>;
1226    pub(crate) fn LLVMBuildCatchPad<'a>(
1227        B: &Builder<'a>,
1228        ParentPad: &'a Value,
1229        Args: *const &'a Value,
1230        NumArgs: c_uint,
1231        Name: *const c_char,
1232    ) -> Option<&'a Value>;
1233    pub(crate) fn LLVMBuildCatchRet<'a>(
1234        B: &Builder<'a>,
1235        CatchPad: &'a Value,
1236        BB: &'a BasicBlock,
1237    ) -> Option<&'a Value>;
1238    pub(crate) fn LLVMBuildCatchSwitch<'a>(
1239        Builder: &Builder<'a>,
1240        ParentPad: Option<&'a Value>,
1241        UnwindBB: Option<&'a BasicBlock>,
1242        NumHandlers: c_uint,
1243        Name: *const c_char,
1244    ) -> Option<&'a Value>;
1245    pub(crate) fn LLVMAddHandler<'a>(CatchSwitch: &'a Value, Dest: &'a BasicBlock);
1246    pub(crate) fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1247
1248    // Add a case to the switch instruction
1249    pub(crate) fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1250
1251    // Add a clause to the landing pad instruction
1252    pub(crate) fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1253
1254    // Set the cleanup on a landing pad instruction
1255    pub(crate) fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1256
1257    // Arithmetic
1258    pub(crate) fn LLVMBuildAdd<'a>(
1259        B: &Builder<'a>,
1260        LHS: &'a Value,
1261        RHS: &'a Value,
1262        Name: *const c_char,
1263    ) -> &'a Value;
1264    pub(crate) fn LLVMBuildFAdd<'a>(
1265        B: &Builder<'a>,
1266        LHS: &'a Value,
1267        RHS: &'a Value,
1268        Name: *const c_char,
1269    ) -> &'a Value;
1270    pub(crate) fn LLVMBuildSub<'a>(
1271        B: &Builder<'a>,
1272        LHS: &'a Value,
1273        RHS: &'a Value,
1274        Name: *const c_char,
1275    ) -> &'a Value;
1276    pub(crate) fn LLVMBuildFSub<'a>(
1277        B: &Builder<'a>,
1278        LHS: &'a Value,
1279        RHS: &'a Value,
1280        Name: *const c_char,
1281    ) -> &'a Value;
1282    pub(crate) fn LLVMBuildMul<'a>(
1283        B: &Builder<'a>,
1284        LHS: &'a Value,
1285        RHS: &'a Value,
1286        Name: *const c_char,
1287    ) -> &'a Value;
1288    pub(crate) fn LLVMBuildFMul<'a>(
1289        B: &Builder<'a>,
1290        LHS: &'a Value,
1291        RHS: &'a Value,
1292        Name: *const c_char,
1293    ) -> &'a Value;
1294    pub(crate) fn LLVMBuildUDiv<'a>(
1295        B: &Builder<'a>,
1296        LHS: &'a Value,
1297        RHS: &'a Value,
1298        Name: *const c_char,
1299    ) -> &'a Value;
1300    pub(crate) fn LLVMBuildExactUDiv<'a>(
1301        B: &Builder<'a>,
1302        LHS: &'a Value,
1303        RHS: &'a Value,
1304        Name: *const c_char,
1305    ) -> &'a Value;
1306    pub(crate) fn LLVMBuildSDiv<'a>(
1307        B: &Builder<'a>,
1308        LHS: &'a Value,
1309        RHS: &'a Value,
1310        Name: *const c_char,
1311    ) -> &'a Value;
1312    pub(crate) fn LLVMBuildExactSDiv<'a>(
1313        B: &Builder<'a>,
1314        LHS: &'a Value,
1315        RHS: &'a Value,
1316        Name: *const c_char,
1317    ) -> &'a Value;
1318    pub(crate) fn LLVMBuildFDiv<'a>(
1319        B: &Builder<'a>,
1320        LHS: &'a Value,
1321        RHS: &'a Value,
1322        Name: *const c_char,
1323    ) -> &'a Value;
1324    pub(crate) fn LLVMBuildURem<'a>(
1325        B: &Builder<'a>,
1326        LHS: &'a Value,
1327        RHS: &'a Value,
1328        Name: *const c_char,
1329    ) -> &'a Value;
1330    pub(crate) fn LLVMBuildSRem<'a>(
1331        B: &Builder<'a>,
1332        LHS: &'a Value,
1333        RHS: &'a Value,
1334        Name: *const c_char,
1335    ) -> &'a Value;
1336    pub(crate) fn LLVMBuildFRem<'a>(
1337        B: &Builder<'a>,
1338        LHS: &'a Value,
1339        RHS: &'a Value,
1340        Name: *const c_char,
1341    ) -> &'a Value;
1342    pub(crate) fn LLVMBuildShl<'a>(
1343        B: &Builder<'a>,
1344        LHS: &'a Value,
1345        RHS: &'a Value,
1346        Name: *const c_char,
1347    ) -> &'a Value;
1348    pub(crate) fn LLVMBuildLShr<'a>(
1349        B: &Builder<'a>,
1350        LHS: &'a Value,
1351        RHS: &'a Value,
1352        Name: *const c_char,
1353    ) -> &'a Value;
1354    pub(crate) fn LLVMBuildAShr<'a>(
1355        B: &Builder<'a>,
1356        LHS: &'a Value,
1357        RHS: &'a Value,
1358        Name: *const c_char,
1359    ) -> &'a Value;
1360    pub(crate) fn LLVMBuildNSWAdd<'a>(
1361        B: &Builder<'a>,
1362        LHS: &'a Value,
1363        RHS: &'a Value,
1364        Name: *const c_char,
1365    ) -> &'a Value;
1366    pub(crate) fn LLVMBuildNUWAdd<'a>(
1367        B: &Builder<'a>,
1368        LHS: &'a Value,
1369        RHS: &'a Value,
1370        Name: *const c_char,
1371    ) -> &'a Value;
1372    pub(crate) fn LLVMBuildNSWSub<'a>(
1373        B: &Builder<'a>,
1374        LHS: &'a Value,
1375        RHS: &'a Value,
1376        Name: *const c_char,
1377    ) -> &'a Value;
1378    pub(crate) fn LLVMBuildNUWSub<'a>(
1379        B: &Builder<'a>,
1380        LHS: &'a Value,
1381        RHS: &'a Value,
1382        Name: *const c_char,
1383    ) -> &'a Value;
1384    pub(crate) fn LLVMBuildNSWMul<'a>(
1385        B: &Builder<'a>,
1386        LHS: &'a Value,
1387        RHS: &'a Value,
1388        Name: *const c_char,
1389    ) -> &'a Value;
1390    pub(crate) fn LLVMBuildNUWMul<'a>(
1391        B: &Builder<'a>,
1392        LHS: &'a Value,
1393        RHS: &'a Value,
1394        Name: *const c_char,
1395    ) -> &'a Value;
1396    pub(crate) fn LLVMBuildAnd<'a>(
1397        B: &Builder<'a>,
1398        LHS: &'a Value,
1399        RHS: &'a Value,
1400        Name: *const c_char,
1401    ) -> &'a Value;
1402    pub(crate) fn LLVMBuildOr<'a>(
1403        B: &Builder<'a>,
1404        LHS: &'a Value,
1405        RHS: &'a Value,
1406        Name: *const c_char,
1407    ) -> &'a Value;
1408    pub(crate) fn LLVMBuildXor<'a>(
1409        B: &Builder<'a>,
1410        LHS: &'a Value,
1411        RHS: &'a Value,
1412        Name: *const c_char,
1413    ) -> &'a Value;
1414    pub(crate) fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
1415    -> &'a Value;
1416    pub(crate) fn LLVMBuildFNeg<'a>(
1417        B: &Builder<'a>,
1418        V: &'a Value,
1419        Name: *const c_char,
1420    ) -> &'a Value;
1421    pub(crate) fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
1422    -> &'a Value;
1423
1424    // Extra flags on arithmetic
1425    pub(crate) fn LLVMSetIsDisjoint(Instr: &Value, IsDisjoint: Bool);
1426    pub(crate) fn LLVMSetNUW(ArithInst: &Value, HasNUW: Bool);
1427    pub(crate) fn LLVMSetNSW(ArithInst: &Value, HasNSW: Bool);
1428
1429    // Memory
1430    pub(crate) fn LLVMBuildAlloca<'a>(
1431        B: &Builder<'a>,
1432        Ty: &'a Type,
1433        Name: *const c_char,
1434    ) -> &'a Value;
1435    pub(crate) fn LLVMBuildLoad2<'a>(
1436        B: &Builder<'a>,
1437        Ty: &'a Type,
1438        PointerVal: &'a Value,
1439        Name: *const c_char,
1440    ) -> &'a Value;
1441
1442    pub(crate) fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1443
1444    pub(crate) fn LLVMBuildGEPWithNoWrapFlags<'a>(
1445        B: &Builder<'a>,
1446        Ty: &'a Type,
1447        Pointer: &'a Value,
1448        Indices: *const &'a Value,
1449        NumIndices: c_uint,
1450        Name: *const c_char,
1451        Flags: GEPNoWrapFlags,
1452    ) -> &'a Value;
1453
1454    // Casts
1455    pub(crate) fn LLVMBuildTrunc<'a>(
1456        B: &Builder<'a>,
1457        Val: &'a Value,
1458        DestTy: &'a Type,
1459        Name: *const c_char,
1460    ) -> &'a Value;
1461    pub(crate) fn LLVMBuildZExt<'a>(
1462        B: &Builder<'a>,
1463        Val: &'a Value,
1464        DestTy: &'a Type,
1465        Name: *const c_char,
1466    ) -> &'a Value;
1467    pub(crate) fn LLVMBuildSExt<'a>(
1468        B: &Builder<'a>,
1469        Val: &'a Value,
1470        DestTy: &'a Type,
1471        Name: *const c_char,
1472    ) -> &'a Value;
1473    pub(crate) fn LLVMBuildFPToUI<'a>(
1474        B: &Builder<'a>,
1475        Val: &'a Value,
1476        DestTy: &'a Type,
1477        Name: *const c_char,
1478    ) -> &'a Value;
1479    pub(crate) fn LLVMBuildFPToSI<'a>(
1480        B: &Builder<'a>,
1481        Val: &'a Value,
1482        DestTy: &'a Type,
1483        Name: *const c_char,
1484    ) -> &'a Value;
1485    pub(crate) fn LLVMBuildUIToFP<'a>(
1486        B: &Builder<'a>,
1487        Val: &'a Value,
1488        DestTy: &'a Type,
1489        Name: *const c_char,
1490    ) -> &'a Value;
1491    pub(crate) fn LLVMBuildSIToFP<'a>(
1492        B: &Builder<'a>,
1493        Val: &'a Value,
1494        DestTy: &'a Type,
1495        Name: *const c_char,
1496    ) -> &'a Value;
1497    pub(crate) fn LLVMBuildFPTrunc<'a>(
1498        B: &Builder<'a>,
1499        Val: &'a Value,
1500        DestTy: &'a Type,
1501        Name: *const c_char,
1502    ) -> &'a Value;
1503    pub(crate) fn LLVMBuildFPExt<'a>(
1504        B: &Builder<'a>,
1505        Val: &'a Value,
1506        DestTy: &'a Type,
1507        Name: *const c_char,
1508    ) -> &'a Value;
1509    pub(crate) fn LLVMBuildPtrToInt<'a>(
1510        B: &Builder<'a>,
1511        Val: &'a Value,
1512        DestTy: &'a Type,
1513        Name: *const c_char,
1514    ) -> &'a Value;
1515    pub(crate) fn LLVMBuildIntToPtr<'a>(
1516        B: &Builder<'a>,
1517        Val: &'a Value,
1518        DestTy: &'a Type,
1519        Name: *const c_char,
1520    ) -> &'a Value;
1521    pub(crate) fn LLVMBuildBitCast<'a>(
1522        B: &Builder<'a>,
1523        Val: &'a Value,
1524        DestTy: &'a Type,
1525        Name: *const c_char,
1526    ) -> &'a Value;
1527    pub(crate) fn LLVMBuildPointerCast<'a>(
1528        B: &Builder<'a>,
1529        Val: &'a Value,
1530        DestTy: &'a Type,
1531        Name: *const c_char,
1532    ) -> &'a Value;
1533    pub(crate) fn LLVMBuildIntCast2<'a>(
1534        B: &Builder<'a>,
1535        Val: &'a Value,
1536        DestTy: &'a Type,
1537        IsSigned: Bool,
1538        Name: *const c_char,
1539    ) -> &'a Value;
1540
1541    // Comparisons
1542    pub(crate) fn LLVMBuildICmp<'a>(
1543        B: &Builder<'a>,
1544        Op: c_uint,
1545        LHS: &'a Value,
1546        RHS: &'a Value,
1547        Name: *const c_char,
1548    ) -> &'a Value;
1549    pub(crate) fn LLVMBuildFCmp<'a>(
1550        B: &Builder<'a>,
1551        Op: c_uint,
1552        LHS: &'a Value,
1553        RHS: &'a Value,
1554        Name: *const c_char,
1555    ) -> &'a Value;
1556
1557    // Miscellaneous instructions
1558    pub(crate) fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char)
1559    -> &'a Value;
1560    pub(crate) fn LLVMBuildSelect<'a>(
1561        B: &Builder<'a>,
1562        If: &'a Value,
1563        Then: &'a Value,
1564        Else: &'a Value,
1565        Name: *const c_char,
1566    ) -> &'a Value;
1567    pub(crate) fn LLVMBuildVAArg<'a>(
1568        B: &Builder<'a>,
1569        list: &'a Value,
1570        Ty: &'a Type,
1571        Name: *const c_char,
1572    ) -> &'a Value;
1573    pub(crate) fn LLVMBuildExtractElement<'a>(
1574        B: &Builder<'a>,
1575        VecVal: &'a Value,
1576        Index: &'a Value,
1577        Name: *const c_char,
1578    ) -> &'a Value;
1579    pub(crate) fn LLVMBuildInsertElement<'a>(
1580        B: &Builder<'a>,
1581        VecVal: &'a Value,
1582        EltVal: &'a Value,
1583        Index: &'a Value,
1584        Name: *const c_char,
1585    ) -> &'a Value;
1586    pub(crate) fn LLVMBuildShuffleVector<'a>(
1587        B: &Builder<'a>,
1588        V1: &'a Value,
1589        V2: &'a Value,
1590        Mask: &'a Value,
1591        Name: *const c_char,
1592    ) -> &'a Value;
1593    pub(crate) fn LLVMBuildExtractValue<'a>(
1594        B: &Builder<'a>,
1595        AggVal: &'a Value,
1596        Index: c_uint,
1597        Name: *const c_char,
1598    ) -> &'a Value;
1599    pub(crate) fn LLVMBuildInsertValue<'a>(
1600        B: &Builder<'a>,
1601        AggVal: &'a Value,
1602        EltVal: &'a Value,
1603        Index: c_uint,
1604        Name: *const c_char,
1605    ) -> &'a Value;
1606
1607    // Atomic Operations
1608    pub(crate) fn LLVMBuildAtomicCmpXchg<'a>(
1609        B: &Builder<'a>,
1610        LHS: &'a Value,
1611        CMP: &'a Value,
1612        RHS: &'a Value,
1613        Order: AtomicOrdering,
1614        FailureOrder: AtomicOrdering,
1615        SingleThreaded: Bool,
1616    ) -> &'a Value;
1617
1618    pub(crate) fn LLVMSetWeak(CmpXchgInst: &Value, IsWeak: Bool);
1619
1620    pub(crate) fn LLVMBuildAtomicRMW<'a>(
1621        B: &Builder<'a>,
1622        Op: AtomicRmwBinOp,
1623        LHS: &'a Value,
1624        RHS: &'a Value,
1625        Order: AtomicOrdering,
1626        SingleThreaded: Bool,
1627    ) -> &'a Value;
1628
1629    pub(crate) fn LLVMBuildFence<'a>(
1630        B: &Builder<'a>,
1631        Order: AtomicOrdering,
1632        SingleThreaded: Bool,
1633        Name: *const c_char,
1634    ) -> &'a Value;
1635
1636    /// Writes a module to the specified path. Returns 0 on success.
1637    pub(crate) fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1638
1639    /// Creates a legacy pass manager -- only used for final codegen.
1640    pub(crate) fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1641
1642    pub(crate) fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1643
1644    pub(crate) fn LLVMGetHostCPUFeatures() -> *mut c_char;
1645
1646    pub(crate) fn LLVMDisposeMessage(message: *mut c_char);
1647
1648    pub(crate) fn LLVMIsMultithreaded() -> Bool;
1649
1650    pub(crate) fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1651
1652    pub(crate) fn LLVMStructSetBody<'a>(
1653        StructTy: &'a Type,
1654        ElementTypes: *const &'a Type,
1655        ElementCount: c_uint,
1656        Packed: Bool,
1657    );
1658
1659    pub(crate) fn LLVMCountStructElementTypes(StructTy: &Type) -> c_uint;
1660    pub(crate) fn LLVMGetStructElementTypes<'a>(StructTy: &'a Type, Dest: *mut &'a Type);
1661
1662    pub(crate) safe fn LLVMMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1663
1664    pub(crate) safe fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
1665
1666    pub(crate) fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
1667
1668    pub(crate) fn LLVMGetOrInsertComdat(M: &Module, Name: *const c_char) -> &Comdat;
1669    pub(crate) fn LLVMSetComdat(V: &Value, C: &Comdat);
1670
1671    pub(crate) fn LLVMCreateOperandBundle(
1672        Tag: *const c_char,
1673        TagLen: size_t,
1674        Args: *const &'_ Value,
1675        NumArgs: c_uint,
1676    ) -> *mut OperandBundle<'_>;
1677    pub(crate) fn LLVMDisposeOperandBundle(Bundle: ptr::NonNull<OperandBundle<'_>>);
1678
1679    pub(crate) fn LLVMBuildCallWithOperandBundles<'a>(
1680        B: &Builder<'a>,
1681        Ty: &'a Type,
1682        Fn: &'a Value,
1683        Args: *const &'a Value,
1684        NumArgs: c_uint,
1685        Bundles: *const &OperandBundle<'a>,
1686        NumBundles: c_uint,
1687        Name: *const c_char,
1688    ) -> &'a Value;
1689    pub(crate) fn LLVMBuildInvokeWithOperandBundles<'a>(
1690        B: &Builder<'a>,
1691        Ty: &'a Type,
1692        Fn: &'a Value,
1693        Args: *const &'a Value,
1694        NumArgs: c_uint,
1695        Then: &'a BasicBlock,
1696        Catch: &'a BasicBlock,
1697        Bundles: *const &OperandBundle<'a>,
1698        NumBundles: c_uint,
1699        Name: *const c_char,
1700    ) -> &'a Value;
1701    pub(crate) fn LLVMBuildCallBr<'a>(
1702        B: &Builder<'a>,
1703        Ty: &'a Type,
1704        Fn: &'a Value,
1705        DefaultDest: &'a BasicBlock,
1706        IndirectDests: *const &'a BasicBlock,
1707        NumIndirectDests: c_uint,
1708        Args: *const &'a Value,
1709        NumArgs: c_uint,
1710        Bundles: *const &OperandBundle<'a>,
1711        NumBundles: c_uint,
1712        Name: *const c_char,
1713    ) -> &'a Value;
1714}
1715
1716// FFI bindings for `DIBuilder` functions in the LLVM-C API.
1717// Try to keep these in the same order as in `llvm/include/llvm-c/DebugInfo.h`.
1718//
1719// FIXME(#134001): Audit all `Option` parameters, especially in lists, to check
1720// that they really are nullable on the C/C++ side. LLVM doesn't appear to
1721// actually document which ones are nullable.
1722unsafe extern "C" {
1723    pub(crate) fn LLVMCreateDIBuilder<'ll>(M: &'ll Module) -> *mut DIBuilder<'ll>;
1724    pub(crate) fn LLVMDisposeDIBuilder<'ll>(Builder: ptr::NonNull<DIBuilder<'ll>>);
1725
1726    pub(crate) fn LLVMDIBuilderFinalize<'ll>(Builder: &DIBuilder<'ll>);
1727
1728    pub(crate) fn LLVMDIBuilderCreateNameSpace<'ll>(
1729        Builder: &DIBuilder<'ll>,
1730        ParentScope: Option<&'ll Metadata>,
1731        Name: *const c_uchar, // See "PTR_LEN_STR".
1732        NameLen: size_t,
1733        ExportSymbols: llvm::Bool,
1734    ) -> &'ll Metadata;
1735
1736    pub(crate) fn LLVMDIBuilderCreateLexicalBlock<'ll>(
1737        Builder: &DIBuilder<'ll>,
1738        Scope: &'ll Metadata,
1739        File: &'ll Metadata,
1740        Line: c_uint,
1741        Column: c_uint,
1742    ) -> &'ll Metadata;
1743
1744    pub(crate) fn LLVMDIBuilderCreateLexicalBlockFile<'ll>(
1745        Builder: &DIBuilder<'ll>,
1746        Scope: &'ll Metadata,
1747        File: &'ll Metadata,
1748        Discriminator: c_uint, // (optional "DWARF path discriminator"; default is 0)
1749    ) -> &'ll Metadata;
1750
1751    pub(crate) fn LLVMDIBuilderCreateDebugLocation<'ll>(
1752        Ctx: &'ll Context,
1753        Line: c_uint,
1754        Column: c_uint,
1755        Scope: &'ll Metadata,
1756        InlinedAt: Option<&'ll Metadata>,
1757    ) -> &'ll Metadata;
1758
1759    pub(crate) fn LLVMDIBuilderCreateSubroutineType<'ll>(
1760        Builder: &DIBuilder<'ll>,
1761        File: Option<&'ll Metadata>, // (ignored and has no effect)
1762        ParameterTypes: *const Option<&'ll Metadata>,
1763        NumParameterTypes: c_uint,
1764        Flags: DIFlags, // (default is `DIFlags::DIFlagZero`)
1765    ) -> &'ll Metadata;
1766
1767    pub(crate) fn LLVMDIBuilderCreateEnumeratorOfArbitraryPrecision<'ll>(
1768        Builder: &DIBuilder<'ll>,
1769        Name: *const c_uchar, // See "PTR_LEN_STR".
1770        NameLen: size_t,
1771        SizeInBits: u64,
1772        Words: *const u64, // LLVM computes `NumWords = (SizeInBits + 63) / 64`.
1773        IsUnsigned: llvm::Bool,
1774    ) -> &'ll Metadata;
1775
1776    pub(crate) fn LLVMDIBuilderCreateUnionType<'ll>(
1777        Builder: &DIBuilder<'ll>,
1778        Scope: Option<&'ll Metadata>,
1779        Name: *const c_uchar, // See "PTR_LEN_STR".
1780        NameLen: size_t,
1781        File: &'ll Metadata,
1782        LineNumber: c_uint,
1783        SizeInBits: u64,
1784        AlignInBits: u32,
1785        Flags: DIFlags,
1786        Elements: *const Option<&'ll Metadata>,
1787        NumElements: c_uint,
1788        RunTimeLang: c_uint, // (optional Objective-C runtime version; default is 0)
1789        UniqueId: *const c_uchar, // See "PTR_LEN_STR".
1790        UniqueIdLen: size_t,
1791    ) -> &'ll Metadata;
1792
1793    pub(crate) fn LLVMDIBuilderCreateArrayType<'ll>(
1794        Builder: &DIBuilder<'ll>,
1795        Size: u64,
1796        Align: u32,
1797        Ty: &'ll Metadata,
1798        Subscripts: *const &'ll Metadata,
1799        NumSubscripts: c_uint,
1800    ) -> &'ll Metadata;
1801
1802    pub(crate) fn LLVMDIBuilderCreateBasicType<'ll>(
1803        Builder: &DIBuilder<'ll>,
1804        Name: *const c_uchar, // See "PTR_LEN_STR".
1805        NameLen: size_t,
1806        SizeInBits: u64,
1807        Encoding: c_uint, // (`LLVMDWARFTypeEncoding`)
1808        Flags: DIFlags,   // (default is `DIFlags::DIFlagZero`)
1809    ) -> &'ll Metadata;
1810
1811    pub(crate) fn LLVMDIBuilderCreatePointerType<'ll>(
1812        Builder: &DIBuilder<'ll>,
1813        PointeeTy: &'ll Metadata,
1814        SizeInBits: u64,
1815        AlignInBits: u32,
1816        AddressSpace: c_uint, // (optional DWARF address space; default is 0)
1817        Name: *const c_uchar, // See "PTR_LEN_STR".
1818        NameLen: size_t,
1819    ) -> &'ll Metadata;
1820
1821    pub(crate) fn LLVMDIBuilderCreateStructType<'ll>(
1822        Builder: &DIBuilder<'ll>,
1823        Scope: Option<&'ll Metadata>,
1824        Name: *const c_uchar, // See "PTR_LEN_STR".
1825        NameLen: size_t,
1826        File: &'ll Metadata,
1827        LineNumber: c_uint,
1828        SizeInBits: u64,
1829        AlignInBits: u32,
1830        Flags: DIFlags,
1831        DerivedFrom: Option<&'ll Metadata>,
1832        Elements: *const Option<&'ll Metadata>,
1833        NumElements: c_uint,
1834        RunTimeLang: c_uint, // (optional Objective-C runtime version; default is 0)
1835        VTableHolder: Option<&'ll Metadata>,
1836        UniqueId: *const c_uchar, // See "PTR_LEN_STR".
1837        UniqueIdLen: size_t,
1838    ) -> &'ll Metadata;
1839
1840    pub(crate) fn LLVMDIBuilderCreateMemberType<'ll>(
1841        Builder: &DIBuilder<'ll>,
1842        Scope: &'ll Metadata,
1843        Name: *const c_uchar, // See "PTR_LEN_STR".
1844        NameLen: size_t,
1845        File: &'ll Metadata,
1846        LineNo: c_uint,
1847        SizeInBits: u64,
1848        AlignInBits: u32,
1849        OffsetInBits: u64,
1850        Flags: DIFlags,
1851        Ty: &'ll Metadata,
1852    ) -> &'ll Metadata;
1853
1854    pub(crate) fn LLVMDIBuilderCreateStaticMemberType<'ll>(
1855        Builder: &DIBuilder<'ll>,
1856        Scope: &'ll Metadata,
1857        Name: *const c_uchar, // See "PTR_LEN_STR".
1858        NameLen: size_t,
1859        File: &'ll Metadata,
1860        LineNumber: c_uint,
1861        Type: &'ll Metadata,
1862        Flags: DIFlags,
1863        ConstantVal: Option<&'ll Value>,
1864        AlignInBits: u32,
1865    ) -> &'ll Metadata;
1866
1867    /// Creates a "qualified type" in the C/C++ sense, by adding modifiers
1868    /// like `const` or `volatile`.
1869    pub(crate) fn LLVMDIBuilderCreateQualifiedType<'ll>(
1870        Builder: &DIBuilder<'ll>,
1871        Tag: c_uint, // (DWARF tag, e.g. `DW_TAG_const_type`)
1872        Type: &'ll Metadata,
1873    ) -> &'ll Metadata;
1874
1875    pub(crate) fn LLVMDIBuilderCreateTypedef<'ll>(
1876        Builder: &DIBuilder<'ll>,
1877        Type: &'ll Metadata,
1878        Name: *const c_uchar, // See "PTR_LEN_STR".
1879        NameLen: size_t,
1880        File: &'ll Metadata,
1881        LineNo: c_uint,
1882        Scope: Option<&'ll Metadata>,
1883        AlignInBits: u32, // (optional; default is 0)
1884    ) -> &'ll Metadata;
1885
1886    pub(crate) fn LLVMDIBuilderGetOrCreateSubrange<'ll>(
1887        Builder: &DIBuilder<'ll>,
1888        LowerBound: i64,
1889        Count: i64,
1890    ) -> &'ll Metadata;
1891
1892    pub(crate) fn LLVMDIBuilderGetOrCreateArray<'ll>(
1893        Builder: &DIBuilder<'ll>,
1894        Data: *const Option<&'ll Metadata>,
1895        NumElements: size_t,
1896    ) -> &'ll Metadata;
1897
1898    pub(crate) fn LLVMDIBuilderCreateExpression<'ll>(
1899        Builder: &DIBuilder<'ll>,
1900        Addr: *const u64,
1901        Length: size_t,
1902    ) -> &'ll Metadata;
1903
1904    pub(crate) fn LLVMDIBuilderCreateGlobalVariableExpression<'ll>(
1905        Builder: &DIBuilder<'ll>,
1906        Scope: Option<&'ll Metadata>,
1907        Name: *const c_uchar, // See "PTR_LEN_STR".
1908        NameLen: size_t,
1909        Linkage: *const c_uchar, // See "PTR_LEN_STR".
1910        LinkLen: size_t,
1911        File: &'ll Metadata,
1912        LineNo: c_uint,
1913        Ty: &'ll Metadata,
1914        LocalToUnit: llvm::Bool,
1915        Expr: &'ll Metadata,
1916        Decl: Option<&'ll Metadata>,
1917        AlignInBits: u32,
1918    ) -> &'ll Metadata;
1919
1920    pub(crate) fn LLVMDIBuilderInsertDeclareRecordAtEnd<'ll>(
1921        Builder: &DIBuilder<'ll>,
1922        Storage: &'ll Value,
1923        VarInfo: &'ll Metadata,
1924        Expr: &'ll Metadata,
1925        DebugLoc: &'ll Metadata,
1926        Block: &'ll BasicBlock,
1927    ) -> &'ll DbgRecord;
1928
1929    pub(crate) fn LLVMDIBuilderInsertDbgValueRecordAtEnd<'ll>(
1930        Builder: &DIBuilder<'ll>,
1931        Val: &'ll Value,
1932        VarInfo: &'ll Metadata,
1933        Expr: &'ll Metadata,
1934        DebugLoc: &'ll Metadata,
1935        Block: &'ll BasicBlock,
1936    ) -> &'ll DbgRecord;
1937
1938    pub(crate) fn LLVMDIBuilderCreateAutoVariable<'ll>(
1939        Builder: &DIBuilder<'ll>,
1940        Scope: &'ll Metadata,
1941        Name: *const c_uchar, // See "PTR_LEN_STR".
1942        NameLen: size_t,
1943        File: &'ll Metadata,
1944        LineNo: c_uint,
1945        Ty: &'ll Metadata,
1946        AlwaysPreserve: llvm::Bool, // "If true, this descriptor will survive optimizations."
1947        Flags: DIFlags,
1948        AlignInBits: u32,
1949    ) -> &'ll Metadata;
1950
1951    pub(crate) fn LLVMDIBuilderCreateParameterVariable<'ll>(
1952        Builder: &DIBuilder<'ll>,
1953        Scope: &'ll Metadata,
1954        Name: *const c_uchar, // See "PTR_LEN_STR".
1955        NameLen: size_t,
1956        ArgNo: c_uint,
1957        File: &'ll Metadata,
1958        LineNo: c_uint,
1959        Ty: &'ll Metadata,
1960        AlwaysPreserve: llvm::Bool, // "If true, this descriptor will survive optimizations."
1961        Flags: DIFlags,
1962    ) -> &'ll Metadata;
1963}
1964
1965#[link(name = "llvm-wrapper", kind = "static")]
1966unsafe extern "C" {
1967    pub(crate) fn LLVMRustInstallErrorHandlers();
1968    pub(crate) fn LLVMRustDisableSystemDialogsOnCrash();
1969
1970    // Operations on all values
1971    /// FIXME: After dropping LLVM 21, migrate to LLVM-C's `LLVMGlobalAddMetadata`.
1972    pub(crate) fn LLVMRustGlobalAddMetadata<'a>(
1973        Val: &'a Value,
1974        KindID: MetadataKindId,
1975        Metadata: &'a Metadata,
1976    );
1977    pub(crate) fn LLVMRustIsNonGVFunctionPointerTy(Val: &Value) -> bool;
1978    pub(crate) fn LLVMRustStripPointerCasts<'a>(Val: &'a Value) -> &'a Value;
1979
1980    // Operations on scalar constants
1981    pub(crate) fn LLVMRustConstIntGetZExtValue(ConstantVal: &ConstantInt, Value: &mut u64) -> bool;
1982    pub(crate) fn LLVMRustConstInt128Get(
1983        ConstantVal: &ConstantInt,
1984        SExt: bool,
1985        high: &mut u64,
1986        low: &mut u64,
1987    ) -> bool;
1988
1989    // Operations on global variables, functions, and aliases (globals)
1990    pub(crate) fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1991
1992    // Operations on global variables
1993    pub(crate) fn LLVMRustGetOrInsertGlobal<'a>(
1994        M: &'a Module,
1995        Name: *const c_char,
1996        NameLen: size_t,
1997        T: &'a Type,
1998    ) -> &'a Value;
1999    pub(crate) fn LLVMRustGetOrInsertGlobalInAddrspace<'a>(
2000        M: &'a Module,
2001        Name: *const c_char,
2002        NameLen: size_t,
2003        T: &'a Type,
2004        AddressSpace: c_uint,
2005    ) -> &'a Value;
2006    pub(crate) fn LLVMRustGetNamedValue(
2007        M: &Module,
2008        Name: *const c_char,
2009        NameLen: size_t,
2010    ) -> Option<&Value>;
2011
2012    // Operations on attributes
2013    pub(crate) fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
2014    pub(crate) fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
2015    pub(crate) fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
2016    pub(crate) fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
2017    pub(crate) fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
2018    pub(crate) fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
2019    pub(crate) fn LLVMRustCreateElementTypeAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
2020    pub(crate) fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
2021    pub(crate) fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute;
2022    pub(crate) fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute;
2023    pub(crate) fn LLVMRustCreateMemoryEffectsAttr(
2024        C: &Context,
2025        effects: MemoryEffects,
2026    ) -> &Attribute;
2027    /// ## Safety
2028    /// - Each of `LowerWords` and `UpperWords` must point to an array that is
2029    ///   long enough to fully define an integer of size `NumBits`, i.e. each
2030    ///   pointer must point to `NumBits.div_ceil(64)` elements or more.
2031    /// - The implementation will make its own copy of the pointed-to `u64`
2032    ///   values, so the pointers only need to outlive this function call.
2033    pub(crate) fn LLVMRustCreateRangeAttribute(
2034        C: &Context,
2035        NumBits: c_uint,
2036        LowerWords: *const u64,
2037        UpperWords: *const u64,
2038    ) -> &Attribute;
2039
2040    // Operations on functions
2041    /// FIXME: After dropping LLVM 21, migrate to LLVM-C's `LLVMGetOrInsertFunction`.
2042    pub(crate) fn LLVMRustGetOrInsertFunction<'a>(
2043        M: &'a Module,
2044        Name: *const c_char,
2045        NameLen: size_t,
2046        FunctionTy: &'a Type,
2047    ) -> &'a Value;
2048    pub(crate) fn LLVMRustAddFunctionAttributes<'a>(
2049        Fn: &'a Value,
2050        index: c_uint,
2051        Attrs: *const &'a Attribute,
2052        AttrsLen: size_t,
2053    );
2054
2055    // Operations on call sites
2056    pub(crate) fn LLVMRustAddCallSiteAttributes<'a>(
2057        Instr: &'a Value,
2058        index: c_uint,
2059        Attrs: *const &'a Attribute,
2060        AttrsLen: size_t,
2061    );
2062
2063    pub(crate) fn LLVMRustSetFastMath(Instr: &Value);
2064    pub(crate) fn LLVMRustSetAlgebraicMath(Instr: &Value);
2065    pub(crate) fn LLVMRustSetAllowReassoc(Instr: &Value);
2066    pub(crate) fn LLVMRustSetNoSignedZeros(Instr: &Value);
2067
2068    // Miscellaneous instructions
2069    pub(crate) fn LLVMRustBuildMemCpy<'a>(
2070        B: &Builder<'a>,
2071        Dst: &'a Value,
2072        DstAlign: c_uint,
2073        Src: &'a Value,
2074        SrcAlign: c_uint,
2075        Size: &'a Value,
2076        IsVolatile: bool,
2077    ) -> &'a Value;
2078    pub(crate) fn LLVMRustBuildMemMove<'a>(
2079        B: &Builder<'a>,
2080        Dst: &'a Value,
2081        DstAlign: c_uint,
2082        Src: &'a Value,
2083        SrcAlign: c_uint,
2084        Size: &'a Value,
2085        IsVolatile: bool,
2086    ) -> &'a Value;
2087    pub(crate) fn LLVMRustBuildMemSet<'a>(
2088        B: &Builder<'a>,
2089        Dst: &'a Value,
2090        DstAlign: c_uint,
2091        Val: &'a Value,
2092        Size: &'a Value,
2093        IsVolatile: bool,
2094    ) -> &'a Value;
2095
2096    pub(crate) fn LLVMRustBuildVScale<'a>(B: &Builder<'a>, Ty: &'a Type) -> &'a Value;
2097
2098    pub(crate) fn LLVMRustTimeTraceProfilerInitialize();
2099
2100    pub(crate) fn LLVMRustTimeTraceProfilerFinishThread();
2101
2102    pub(crate) fn LLVMRustTimeTraceProfilerFinish(FileName: *const c_char);
2103
2104    /// Returns a string describing the last error caused by an LLVMRust* call.
2105    pub(crate) fn LLVMRustGetLastError() -> *const c_char;
2106
2107    /// Prints the timing information collected by `-Ztime-llvm-passes`.
2108    pub(crate) fn LLVMRustPrintPassTimings(OutStr: &RustString);
2109
2110    /// Prints the statistics collected by `-Zprint-codegen-stats`.
2111    pub(crate) fn LLVMRustPrintStatistics(OutStr: &RustString);
2112
2113    /// Save the statistics collected by `-Zprint-codegen-stats-json`
2114    pub(crate) fn LLVMRustPrintStatisticsJSON(OutStr: &RustString);
2115
2116    pub(crate) fn LLVMRustInlineAsmVerify(
2117        Ty: &Type,
2118        Constraints: *const c_uchar, // See "PTR_LEN_STR".
2119        ConstraintsLen: size_t,
2120    ) -> bool;
2121
2122    /// Append inline assembly to a module. See `Module::appendModuleInlineAsm`.
2123    pub(crate) fn LLVMRustAppendModuleInlineAsm(
2124        M: &Module,
2125        Asm: *const c_uchar, // See "PTR_LEN_STR".
2126        AsmLen: size_t,
2127        TargetFeatures: *const c_uchar, // See "PTR_LEN_STR".
2128        TargetFeaturesLen: size_t,
2129        TargetCpu: *const c_uchar, // See "PTR_LEN_STR".
2130        TargetCpuLen: size_t,
2131    );
2132
2133    /// A list of pointer-length strings is passed as two pointer-length slices,
2134    /// one slice containing pointers and one slice containing their corresponding
2135    /// lengths. The implementation will check that both slices have the same length.
2136    pub(crate) fn LLVMRustCoverageWriteFilenamesToBuffer(
2137        Filenames: *const *const c_uchar, // See "PTR_LEN_STR".
2138        FilenamesLen: size_t,
2139        Lengths: *const size_t,
2140        LengthsLen: size_t,
2141        BufferOut: &RustString,
2142    );
2143
2144    pub(crate) fn LLVMRustCoverageWriteFunctionMappingsToBuffer(
2145        VirtualFileMappingIDs: *const c_uint,
2146        NumVirtualFileMappingIDs: size_t,
2147        Expressions: *const crate::coverageinfo::ffi::CounterExpression,
2148        NumExpressions: size_t,
2149        CodeRegions: *const crate::coverageinfo::ffi::CodeRegion,
2150        NumCodeRegions: size_t,
2151        ExpansionRegions: *const crate::coverageinfo::ffi::ExpansionRegion,
2152        NumExpansionRegions: size_t,
2153        BranchRegions: *const crate::coverageinfo::ffi::BranchRegion,
2154        NumBranchRegions: size_t,
2155        BufferOut: &RustString,
2156    );
2157
2158    pub(crate) fn LLVMRustCoverageCreatePGOFuncNameVar(
2159        F: &Value,
2160        FuncName: *const c_uchar, // See "PTR_LEN_STR".
2161        FuncNameLen: size_t,
2162    ) -> &Value;
2163    pub(crate) fn LLVMRustCoverageHashBytes(
2164        Bytes: *const c_uchar, // See "PTR_LEN_STR".
2165        NumBytes: size_t,
2166    ) -> u64;
2167
2168    pub(crate) safe fn LLVMRustCoverageWriteCovmapSectionNameToString(
2169        M: &Module,
2170        OutStr: &RustString,
2171    );
2172    pub(crate) safe fn LLVMRustCoverageWriteCovfunSectionNameToString(
2173        M: &Module,
2174        OutStr: &RustString,
2175    );
2176    pub(crate) safe fn LLVMRustCoverageWriteCovmapVarNameToString(OutStr: &RustString);
2177
2178    pub(crate) safe fn LLVMRustCoverageMappingVersion() -> u32;
2179    pub(crate) fn LLVMRustDebugMetadataVersion() -> u32;
2180
2181    /// Returns the LLVM major version that the compiler was built with.
2182    ///
2183    /// Note that this is hard-coded as `LLVM_VERSION_MAJOR` when `RustWrapper.cpp` is built. This
2184    /// could be different than what the runtime LLVM library reports in [`LLVMGetVersion`], so we
2185    /// assert their equality in `configure_llvm`.
2186    pub(crate) safe fn LLVMRustVersionMajor() -> u32;
2187
2188    /// Add LLVM module flags.
2189    ///
2190    /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
2191    /// "compatible" means depends on the merge behaviors involved.
2192    pub(crate) fn LLVMRustAddModuleFlagU32(
2193        M: &Module,
2194        MergeBehavior: ModuleFlagMergeBehavior,
2195        Name: *const c_char,
2196        NameLen: size_t,
2197        Value: u32,
2198    );
2199
2200    pub(crate) fn LLVMRustAddModuleFlagString(
2201        M: &Module,
2202        MergeBehavior: ModuleFlagMergeBehavior,
2203        Name: *const c_char,
2204        NameLen: size_t,
2205        Value: *const c_char,
2206        ValueLen: size_t,
2207    );
2208
2209    /// We can't use LLVM-C's `LLVMDIBuilderCreateCompileUnit` because it hardcodes
2210    /// `DICompileUnit::DebugNameTableKind::Default`, but we want to be able to
2211    /// pass other values.
2212    pub(crate) fn LLVMRustDIBuilderCreateCompileUnit<'a>(
2213        Builder: &DIBuilder<'a>,
2214        Lang: c_uint,
2215        File: &'a DIFile,
2216        Producer: *const c_char,
2217        ProducerLen: size_t,
2218        isOptimized: bool,
2219        Flags: *const c_char,
2220        RuntimeVer: c_uint,
2221        SplitName: *const c_char,
2222        SplitNameLen: size_t,
2223        kind: DebugEmissionKind,
2224        DWOId: u64,
2225        SplitDebugInlining: bool,
2226        DebugNameTableKind: DebugNameTableKind,
2227    ) -> &'a DIDescriptor;
2228
2229    /// We can't use LLVM-C's `LLVMDIBuilderCreateFileWithChecksum` because it
2230    /// _requires_ a checksum, but we sometimes don't provide one.
2231    pub(crate) fn LLVMRustDIBuilderCreateFile<'a>(
2232        Builder: &DIBuilder<'a>,
2233        Filename: *const c_char,
2234        FilenameLen: size_t,
2235        Directory: *const c_char,
2236        DirectoryLen: size_t,
2237        CSKind: ChecksumKind,
2238        Checksum: *const c_char,
2239        ChecksumLen: size_t,
2240        Source: *const c_char,
2241        SourceLen: size_t,
2242    ) -> &'a DIFile;
2243
2244    /// We can't use LLVM-C's `LLVMDIBuilderCreateFunction` because it only
2245    /// supports a subset of `DISubprogram::DISPFlags`.
2246    pub(crate) fn LLVMRustDIBuilderCreateFunction<'a>(
2247        Builder: &DIBuilder<'a>,
2248        Scope: &'a DIDescriptor,
2249        Name: *const c_char,
2250        NameLen: size_t,
2251        LinkageName: *const c_char,
2252        LinkageNameLen: size_t,
2253        File: &'a DIFile,
2254        LineNo: c_uint,
2255        Ty: &'a DIType,
2256        ScopeLine: c_uint,
2257        Flags: DIFlags,
2258        SPFlags: DISPFlags,
2259        MaybeFn: Option<&'a Value>,
2260        TParam: &'a DIArray,
2261        Decl: Option<&'a DIDescriptor>,
2262    ) -> &'a DISubprogram;
2263
2264    /// As of LLVM 22 there is no corresponding LLVM-C function.
2265    pub(crate) fn LLVMRustDIBuilderCreateMethod<'a>(
2266        Builder: &DIBuilder<'a>,
2267        Scope: &'a DIDescriptor,
2268        Name: *const c_char,
2269        NameLen: size_t,
2270        LinkageName: *const c_char,
2271        LinkageNameLen: size_t,
2272        File: &'a DIFile,
2273        LineNo: c_uint,
2274        Ty: &'a DIType,
2275        Flags: DIFlags,
2276        SPFlags: DISPFlags,
2277        TParam: &'a DIArray,
2278    ) -> &'a DISubprogram;
2279
2280    /// As of LLVM 22 there is no corresponding LLVM-C function.
2281    pub(crate) fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2282        Builder: &DIBuilder<'a>,
2283        Scope: &'a DIScope,
2284        Name: *const c_char,
2285        NameLen: size_t,
2286        File: &'a DIFile,
2287        LineNumber: c_uint,
2288        SizeInBits: u64,
2289        AlignInBits: u32,
2290        OffsetInBits: u64,
2291        Discriminant: Option<&'a Value>,
2292        Flags: DIFlags,
2293        Ty: &'a DIType,
2294    ) -> &'a DIType;
2295
2296    /// As of LLVM 22 there is no corresponding LLVM-C function.
2297    pub(crate) fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2298        Builder: &DIBuilder<'a>,
2299        Scope: &'a DIScope,
2300        Name: *const c_char,
2301        NameLen: size_t,
2302        File: &'a DIFile,
2303        LineNumber: c_uint,
2304        SizeInBits: u64,
2305        AlignInBits: u32,
2306        Elements: &'a DIArray,
2307        ClassType: &'a DIType,
2308        IsScoped: bool,
2309    ) -> &'a DIType;
2310
2311    /// As of LLVM 22 there is no corresponding LLVM-C function.
2312    pub(crate) fn LLVMRustDIBuilderCreateVariantPart<'a>(
2313        Builder: &DIBuilder<'a>,
2314        Scope: &'a DIScope,
2315        Name: *const c_char,
2316        NameLen: size_t,
2317        File: &'a DIFile,
2318        LineNo: c_uint,
2319        SizeInBits: u64,
2320        AlignInBits: u32,
2321        Flags: DIFlags,
2322        Discriminator: Option<&'a DIDerivedType>,
2323        Elements: &'a DIArray,
2324        UniqueId: *const c_char,
2325        UniqueIdLen: size_t,
2326    ) -> &'a DIDerivedType;
2327
2328    /// As of LLVM 22 there is no corresponding LLVM-C function.
2329    pub(crate) fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2330        Builder: &DIBuilder<'a>,
2331        Scope: Option<&'a DIScope>,
2332        Name: *const c_char,
2333        NameLen: size_t,
2334        Ty: &'a DIType,
2335    ) -> &'a DITemplateTypeParameter;
2336
2337    /// We can't use LLVM-C's `LLVMReplaceArrays` because it doesn't take a
2338    /// `Params` argument.
2339    pub(crate) fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2340        Builder: &DIBuilder<'a>,
2341        CompositeType: &'a DIType,
2342        Elements: Option<&'a DIArray>,
2343        Params: Option<&'a DIArray>,
2344    );
2345
2346    /// We can't use LLVM-C's `LLVMDIBuilderGetOrCreateSubrange` because it doesn't
2347    /// call the overload that takes a `Metadata` upper bound.
2348    pub(crate) fn LLVMRustDIGetOrCreateSubrange<'a>(
2349        Builder: &DIBuilder<'a>,
2350        CountNode: Option<&'a Metadata>,
2351        LB: &'a Metadata,
2352        UB: &'a Metadata,
2353        Stride: Option<&'a Metadata>,
2354    ) -> &'a Metadata;
2355
2356    /// We can't use LLVM-C's `LLVMDIBuilderCreateVectorType` because it doesn't
2357    /// take a `BitStride` argument.
2358    pub(crate) fn LLVMRustDICreateVectorType<'a>(
2359        Builder: &DIBuilder<'a>,
2360        Size: u64,
2361        AlignInBits: u32,
2362        Type: &'a DIType,
2363        Subscripts: &'a DIArray,
2364        BitStride: Option<&'a Metadata>,
2365    ) -> &'a Metadata;
2366
2367    /// As of LLVM 22 there is no corresponding LLVM-C function.
2368    pub(crate) fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
2369        Location: &'a DILocation,
2370        BD: c_uint,
2371    ) -> Option<&'a DILocation>;
2372
2373    pub(crate) fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2374    pub(crate) fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2375
2376    pub(crate) fn LLVMRustTargetHasMnemonic(T: &TargetMachine, s: *const c_char) -> bool;
2377
2378    pub(crate) fn LLVMRustPrintTargetCPUs(TM: &TargetMachine, OutStr: &RustString);
2379    pub(crate) fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2380    pub(crate) fn LLVMRustGetTargetFeature(
2381        T: &TargetMachine,
2382        Index: size_t,
2383        Feature: &mut *const c_char,
2384        Desc: &mut *const c_char,
2385    );
2386
2387    pub(crate) fn LLVMRustGetHostCPUName(LenOut: &mut size_t) -> *const u8;
2388
2389    // This function makes copies of pointed to data, so the data's lifetime may end after this
2390    // function returns.
2391    pub(crate) fn LLVMRustCreateTargetMachine(
2392        Triple: *const c_char,
2393        CPU: *const c_char,
2394        Features: *const c_char,
2395        Abi: *const c_char,
2396        Model: CodeModel,
2397        Reloc: RelocModel,
2398        Level: CodeGenOptLevel,
2399        FloatABIType: FloatAbi,
2400        FunctionSections: bool,
2401        DataSections: bool,
2402        UniqueSectionNames: bool,
2403        TrapUnreachable: bool,
2404        Singlethread: bool,
2405        VerboseAsm: bool,
2406        EmitStackSizeSection: bool,
2407        RelaxELFRelocations: bool,
2408        UseInitArray: bool,
2409        SplitDwarfFile: *const c_char,
2410        OutputObjFile: *const c_char,
2411        DebugInfoCompression: CompressionKind,
2412        UseEmulatedTls: bool,
2413        UseWasmEH: bool,
2414        LargeDataThreshold: u64,
2415    ) -> *mut TargetMachine;
2416
2417    pub(crate) fn LLVMRustCreateMCSubtargetInfo(
2418        TripleStr: *const c_char,
2419        CPU: *const c_char,
2420        Features: *const c_char,
2421    ) -> *mut MCSubtargetInfo;
2422
2423    pub(crate) fn LLVMRustMCSubtargetInfoHasFeature(
2424        MCInfo: &MCSubtargetInfo,
2425        Feature: *const c_char,
2426    ) -> bool;
2427
2428    pub(crate) fn LLVMRustDisposeMCSubtargetInfo(MCInfo: ptr::NonNull<MCSubtargetInfo>);
2429
2430    pub(crate) fn LLVMRustAddLibraryInfo<'a>(
2431        T: &TargetMachine,
2432        PM: &PassManager<'a>,
2433        M: &'a Module,
2434        DisableSimplifyLibCalls: bool,
2435    );
2436    pub(crate) fn LLVMRustWriteOutputFile<'a>(
2437        T: &'a TargetMachine,
2438        PM: *mut PassManager<'a>,
2439        M: &'a Module,
2440        Output: *const c_char,
2441        DwoOutput: *const c_char,
2442        FileType: FileType,
2443        VerifyIR: bool,
2444    ) -> LLVMRustResult;
2445    pub(crate) fn LLVMRustOptimize<'a>(
2446        M: &'a Module,
2447        TM: &'a TargetMachine,
2448        OptLevel: PassBuilderOptLevel,
2449        OptStage: OptStage,
2450        IsLinkerPluginLTO: bool,
2451        NoPrepopulatePasses: bool,
2452        VerifyIR: bool,
2453        LintIR: bool,
2454        ThinLTOBuffer: Option<&mut Option<crate::back::lto::Buffer>>,
2455        ThinLTOSummaryBuffer: Option<&mut Option<crate::back::lto::Buffer>>,
2456        MergeFunctions: bool,
2457        UnrollLoops: bool,
2458        SLPVectorize: bool,
2459        LoopVectorize: bool,
2460        DisableSimplifyLibCalls: bool,
2461        EmitLifetimeMarkers: bool,
2462        RunEnzyme: *const c_void,
2463        PrintBeforeEnzyme: bool,
2464        PrintAfterEnzyme: bool,
2465        PrintPasses: bool,
2466        SanitizerOptions: Option<&SanitizerOptions>,
2467        PGOGenPath: *const c_char,
2468        PGOUsePath: *const c_char,
2469        InstrumentCoverage: bool,
2470        InstrProfileOutput: *const c_char,
2471        PGOSampleUsePath: *const c_char,
2472        DebugInfoForProfiling: bool,
2473        llvm_selfprofiler: *mut c_void,
2474        begin_callback: SelfProfileBeforePassCallback,
2475        end_callback: SelfProfileAfterPassCallback,
2476        PostEnzymePasses: *const c_char,
2477        PostEnzymePassesLen: size_t,
2478        ExtraPasses: *const c_char,
2479        ExtraPassesLen: size_t,
2480        LLVMPlugins: *const c_char,
2481        LLVMPluginsLen: size_t,
2482    ) -> LLVMRustResult;
2483    pub(crate) fn LLVMRustPrintModule(
2484        M: &Module,
2485        Output: *const c_char,
2486        Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2487    ) -> LLVMRustResult;
2488    pub(crate) fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2489    pub(crate) fn LLVMRustPrintPasses();
2490    pub(crate) fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2491    pub(crate) fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2492
2493    pub(crate) fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2494
2495    pub(crate) fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2496        DI: &'a DiagnosticInfo,
2497        pass_name_out: &RustString,
2498        function_out: &mut Option<&'a Value>,
2499        loc_line_out: &mut c_uint,
2500        loc_column_out: &mut c_uint,
2501        loc_filename_out: &RustString,
2502        message_out: &RustString,
2503    );
2504
2505    pub(crate) fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2506        DI: &'a DiagnosticInfo,
2507        level_out: &mut DiagnosticLevel,
2508        cookie_out: &mut u64,
2509        message_out: &mut Option<&'a Twine>,
2510    );
2511
2512    pub(crate) fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2513    pub(crate) fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2514
2515    pub(crate) fn LLVMRustGetSMDiagnostic<'a>(
2516        DI: &'a DiagnosticInfo,
2517        cookie_out: &mut u64,
2518    ) -> &'a SMDiagnostic;
2519
2520    pub(crate) fn LLVMRustUnpackSMDiagnostic(
2521        d: &SMDiagnostic,
2522        message_out: &RustString,
2523        buffer_out: &RustString,
2524        level_out: &mut DiagnosticLevel,
2525        loc_out: &mut c_uint,
2526        ranges_out: *mut c_uint,
2527        num_ranges: &mut usize,
2528    ) -> bool;
2529
2530    pub(crate) fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2531
2532    pub(crate) fn LLVMRustPositionBuilderPastAllocas<'a>(B: &Builder<'a>, Fn: &'a Value);
2533    pub(crate) fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2534
2535    pub(crate) fn LLVMRustSetModulePICLevel(M: &Module);
2536    pub(crate) fn LLVMRustSetModulePIELevel(M: &Module);
2537    pub(crate) fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2538    pub(crate) fn LLVMRustSetModuleLargeDataThreshold(M: &Module, Threshold: u64);
2539    pub(crate) fn LLVMRustBufferPtr(p: &Buffer) -> *const u8;
2540    pub(crate) fn LLVMRustBufferLen(p: &Buffer) -> usize;
2541    pub(crate) fn LLVMRustBufferFree(p: &'static mut Buffer);
2542    pub(crate) fn LLVMRustModuleCost(M: &Module) -> u64;
2543    pub(crate) fn LLVMRustModuleInstructionStats(M: &Module) -> u64;
2544
2545    pub(crate) fn LLVMRustModuleSerialize(M: &Module, is_thin: bool) -> &'static mut Buffer;
2546    pub(crate) fn LLVMRustCreateThinLTOData(
2547        Modules: *const ThinLTOModule,
2548        NumModules: size_t,
2549        PreservedSymbols: *const *const c_char,
2550        PreservedSymbolsLen: size_t,
2551    ) -> Option<&'static mut ThinLTOData>;
2552    pub(crate) fn LLVMRustPrepareThinLTORename(
2553        Data: &ThinLTOData,
2554        Module: &Module,
2555        Target: &TargetMachine,
2556    );
2557    pub(crate) fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2558    pub(crate) fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2559    pub(crate) fn LLVMRustPrepareThinLTOImport(
2560        Data: &ThinLTOData,
2561        Module: &Module,
2562        Target: &TargetMachine,
2563    ) -> bool;
2564    pub(crate) fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2565    pub(crate) fn LLVMRustParseBitcodeForLTO(
2566        Context: &Context,
2567        Data: *const u8,
2568        len: usize,
2569        Identifier: *const c_char,
2570    ) -> Option<&Module>;
2571
2572    pub(crate) fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2573    pub(crate) fn LLVMRustLinkerAdd(
2574        linker: &Linker<'_>,
2575        bytecode: *const c_char,
2576        bytecode_len: usize,
2577    ) -> bool;
2578    pub(crate) fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2579    pub(crate) fn LLVMRustComputeLTOCacheKey(
2580        key_out: &RustString,
2581        mod_id: *const c_char,
2582        data: &ThinLTOData,
2583    );
2584
2585    pub(crate) fn LLVMRustContextGetDiagnosticHandler(
2586        Context: &Context,
2587    ) -> Option<&DiagnosticHandler>;
2588    pub(crate) fn LLVMRustContextSetDiagnosticHandler(
2589        context: &Context,
2590        diagnostic_handler: Option<&DiagnosticHandler>,
2591    );
2592    pub(crate) fn LLVMRustContextConfigureDiagnosticHandler(
2593        context: &Context,
2594        diagnostic_handler_callback: DiagnosticHandlerTy,
2595        diagnostic_handler_context: *mut c_void,
2596        remark_all_passes: bool,
2597        remark_passes: *const *const c_char,
2598        remark_passes_len: usize,
2599        remark_file: *const c_char,
2600        pgo_available: bool,
2601    );
2602
2603    pub(crate) fn LLVMRustGetMangledName(V: &Value, out: &RustString);
2604
2605    pub(crate) fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;
2606
2607    pub(crate) safe fn LLVMRustLLVMHasZlibCompression() -> bool;
2608    pub(crate) safe fn LLVMRustLLVMHasZstdCompression() -> bool;
2609
2610    pub(crate) fn LLVMRustGetSymbols(
2611        buf_ptr: *const u8,
2612        buf_len: usize,
2613        state: *mut c_void,
2614        callback: GetSymbolsCallback,
2615        error_callback: GetSymbolsErrorCallback,
2616    ) -> *mut c_void;
2617
2618    pub(crate) fn LLVMRustIs64BitSymbolicFile(buf_ptr: *const u8, buf_len: usize) -> bool;
2619
2620    pub(crate) fn LLVMRustIsECObject(buf_ptr: *const u8, buf_len: usize) -> bool;
2621
2622    pub(crate) fn LLVMRustIsAnyArm64Coff(buf_ptr: *const u8, buf_len: usize) -> bool;
2623
2624    pub(crate) fn LLVMRustSetNoSanitizeAddress(Global: &Value);
2625    pub(crate) fn LLVMRustSetNoSanitizeHWAddress(Global: &Value);
2626
2627    pub(crate) fn LLVMRustConstPtrAuth(
2628        ptr: *const Value,
2629        key: u32,
2630        disc: u64,
2631        addr_diversity: *const Value,
2632        deactivation_symbol: *const Value,
2633    ) -> *const Value;
2634}