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
23pub(crate) use self::branded::{Context, ContextRaw, Module, ModuleRaw, wrap_llcx, wrap_llmod};
24use super::RustString;
25use super::debuginfo::{
26    DIArray, DIBuilder, DIDerivedType, DIDescriptor, DIFile, DIFlags, DILocation, DISPFlags,
27    DIScope, DISubprogram, DITemplateTypeParameter, DIType, DebugEmissionKind, DebugNameTableKind,
28};
29use crate::llvm;
30use crate::llvm::MetadataKindId;
31use crate::macros::TryFromU32;
32
33mod branded;
34
35/// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
36/// which has a different ABI from Rust or C++ `bool`.
37///
38/// This wrapper does not implement `PartialEq`.
39/// To test the underlying boolean value, use [`Self::is_true`].
40#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for Bool {
}
#[automatically_derived]impl ::core::clone::Clone for Bool {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_int>;
        *self
    }
}Clone, #[automatically_derived]impl ::core::marker::Copy for Bool { }Copy)]
41#[repr(transparent)]
42pub(crate) struct Bool {
43    value: c_int,
44}
45
46pub(crate) const TRUE: Bool = Bool::TRUE;
47pub(crate) const FALSE: Bool = Bool::FALSE;
48
49impl Bool {
50    pub(crate) const TRUE: Self = Self { value: 1 };
51    pub(crate) const FALSE: Self = Self { value: 0 };
52
53    pub(crate) const fn from_bool(rust_bool: bool) -> Self {
54        if rust_bool { Self::TRUE } else { Self::FALSE }
55    }
56
57    /// Converts this LLVM-C boolean to a Rust `bool`
58    pub(crate) fn is_true(self) -> bool {
59        // Since we're interacting with a C API, follow the C convention of
60        // treating any nonzero value as true.
61        self.value != Self::FALSE.value
62    }
63}
64
65impl Debug for Bool {
66    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
67        match self.value {
68            0 => f.write_str("FALSE"),
69            1 => f.write_str("TRUE"),
70            // As with `Self::is_true`, treat any nonzero value as true.
71            v => f.write_fmt(format_args!("TRUE ({0})", v))write!(f, "TRUE ({v})"),
72        }
73    }
74}
75
76/// Convenience trait to convert `bool` to `llvm::Bool` with an explicit method call.
77///
78/// Being able to write `b.to_llvm_bool()` is less noisy than `llvm::Bool::from(b)`,
79/// while being more explicit and less mistake-prone than something like `b.into()`.
80pub(crate) trait ToLlvmBool: Copy {
81    fn to_llvm_bool(self) -> llvm::Bool;
82}
83
84impl ToLlvmBool for bool {
85    #[inline(always)]
86    fn to_llvm_bool(self) -> llvm::Bool {
87        llvm::Bool::from_bool(self)
88    }
89}
90
91/// Wrapper for a raw enum value returned from LLVM's C APIs.
92///
93/// For C enums returned by LLVM, it's risky to use a Rust enum as the return
94/// type, because it would be UB if a later version of LLVM adds a new enum
95/// value and returns it. Instead, return this raw wrapper, then convert to the
96/// Rust-side enum explicitly.
97#[repr(transparent)]
98pub(crate) struct RawEnum<T> {
99    value: u32,
100    /// We don't own or consume a `T`, but we can produce one.
101    _rust_side_type: PhantomData<fn() -> T>,
102}
103
104impl<T: TryFrom<u32>> RawEnum<T> {
105    #[track_caller]
106    pub(crate) fn to_rust(self) -> T
107    where
108        T::Error: Debug,
109    {
110        // If this fails, the Rust-side enum is out of sync with LLVM's enum.
111        T::try_from(self.value).expect("enum value returned by LLVM should be known")
112    }
113}
114
115#[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) -> Self { *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: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
116#[repr(C)]
117#[allow(dead_code)] // Variants constructed by C++.
118pub(crate) enum LLVMRustResult {
119    Success,
120    Failure,
121}
122
123/// Must match the layout of `LLVMRustModuleFlagMergeBehavior`.
124///
125/// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are
126/// resolved according to the merge behaviors specified here. Flags differing only in merge
127/// behavior are still considered to be in conflict.
128///
129/// In order for Rust-C LTO to work, we must specify behaviors compatible with Clang. Notably,
130/// 'Error' and 'Warning' cannot be mixed for a given flag.
131///
132/// There is a stable LLVM-C version of this enum (`LLVMModuleFlagBehavior`),
133/// but as of LLVM 19 it does not support all of the enum values in the unstable
134/// C++ API.
135#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    ModuleFlagMergeBehavior {
}
#[automatically_derived]impl ::core::cmp::PartialEq for
    ModuleFlagMergeBehavior {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
136#[repr(C)]
137pub(crate) enum ModuleFlagMergeBehavior {
138    Error = 1,
139    Warning = 2,
140    Require = 3,
141    Override = 4,
142    Append = 5,
143    AppendUnique = 6,
144    Max = 7,
145    Min = 8,
146}
147
148// Consts for the LLVM CallConv type, pre-cast to usize.
149
150/// Must match the layout of `LLVMTailCallKind`.
151#[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) -> Self { *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: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}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)]
152#[repr(C)]
153#[allow(dead_code)]
154pub(crate) enum TailCallKind {
155    None = 0,
156    Tail = 1,
157    MustTail = 2,
158    NoTail = 3,
159}
160
161/// LLVM CallingConv::ID. Should we wrap this?
162///
163/// See <https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/CallingConv.h>
164#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for CallConv
    {
}
#[automatically_derived]impl ::core::cmp::PartialEq for CallConv {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]impl ::core::fmt::Debug for CallConv {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_c_like_enum_write_str(f,
            "CCallConv FastCallConv ColdCallConv PreserveMost PreserveAll SwiftCallConv Tail PreserveNone X86StdcallCallConv X86FastcallCallConv ArmAapcsCallConv Msp430Intr X86_ThisCall PtxKernel X86_64_SysV X86_64_Win64 X86_VectorCall X86_Intr AvrNonBlockingInterrupt AvrInterrupt AmdgpuKernel",
            match self {
                CallConv::CCallConv => 0usize,
                CallConv::FastCallConv => 10usize,
                CallConv::ColdCallConv => 23usize,
                CallConv::PreserveMost => 36usize,
                CallConv::PreserveAll => 49usize,
                CallConv::SwiftCallConv => 61usize,
                CallConv::Tail => 75usize,
                CallConv::PreserveNone => 80usize,
                CallConv::X86StdcallCallConv => 93usize,
                CallConv::X86FastcallCallConv => 112usize,
                CallConv::ArmAapcsCallConv => 132usize,
                CallConv::Msp430Intr => 149usize,
                CallConv::X86_ThisCall => 160usize,
                CallConv::PtxKernel => 173usize,
                CallConv::X86_64_SysV => 183usize,
                CallConv::X86_64_Win64 => 195usize,
                CallConv::X86_VectorCall => 208usize,
                CallConv::X86_Intr => 223usize,
                CallConv::AvrNonBlockingInterrupt => 232usize,
                CallConv::AvrInterrupt => 256usize,
                CallConv::AmdgpuKernel => 269usize,
            })
    }
}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)]
165#[repr(C)]
166pub(crate) enum CallConv {
167    CCallConv = 0,
168    FastCallConv = 8,
169    ColdCallConv = 9,
170    PreserveMost = 14,
171    PreserveAll = 15,
172    SwiftCallConv = 16,
173    Tail = 18,
174    PreserveNone = 21,
175    X86StdcallCallConv = 64,
176    X86FastcallCallConv = 65,
177    ArmAapcsCallConv = 67,
178    Msp430Intr = 69,
179    X86_ThisCall = 70,
180    PtxKernel = 71,
181    X86_64_SysV = 78,
182    X86_64_Win64 = 79,
183    X86_VectorCall = 80,
184    X86_Intr = 83,
185    AvrNonBlockingInterrupt = 84,
186    AvrInterrupt = 85,
187    AmdgpuKernel = 91,
188}
189
190/// Must match the layout of `LLVMLinkage`.
191#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for Linkage {
}
#[automatically_derived]impl ::core::cmp::PartialEq for Linkage {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}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)]
192#[repr(C)]
193pub(crate) enum Linkage {
194    ExternalLinkage = 0,
195    AvailableExternallyLinkage = 1,
196    LinkOnceAnyLinkage = 2,
197    LinkOnceODRLinkage = 3,
198    #[deprecated = "marked obsolete by LLVM"]
199    LinkOnceODRAutoHideLinkage = 4,
200    WeakAnyLinkage = 5,
201    WeakODRLinkage = 6,
202    AppendingLinkage = 7,
203    InternalLinkage = 8,
204    PrivateLinkage = 9,
205    #[deprecated = "marked obsolete by LLVM"]
206    DLLImportLinkage = 10,
207    #[deprecated = "marked obsolete by LLVM"]
208    DLLExportLinkage = 11,
209    ExternalWeakLinkage = 12,
210    #[deprecated = "marked obsolete by LLVM"]
211    GhostLinkage = 13,
212    CommonLinkage = 14,
213    LinkerPrivateLinkage = 15,
214    LinkerPrivateWeakLinkage = 16,
215}
216
217/// Must match the layout of `LLVMVisibility`.
218#[repr(C)]
219#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    Visibility {
}
#[automatically_derived]impl ::core::cmp::PartialEq for Visibility {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}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)]
220pub(crate) enum Visibility {
221    Default = 0,
222    Hidden = 1,
223    Protected = 2,
224}
225
226/// LLVMUnnamedAddr
227#[repr(C)]
228pub(crate) enum UnnamedAddr {
229    No,
230    #[expect(dead_code)]
231    Local,
232    Global,
233}
234
235/// LLVMDLLStorageClass
236#[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) -> Self { *self }
}Clone)]
237#[repr(C)]
238pub(crate) enum DLLStorageClass {
239    #[allow(dead_code)]
240    Default = 0,
241    DllImport = 1, // Function to be imported from DLL.
242    #[allow(dead_code)]
243    DllExport = 2, // Function to be accessible from DLL.
244}
245
246/// Must match the layout of `llvm::UWTableKind`.
247#[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) -> Self { *self }
}Clone)]
248#[repr(C)]
249pub(crate) enum UWTableKind {
250    /// No unwind table requested
251    None = 0,
252    /// "Synchronous" unwind tables
253    Sync = 1,
254    /// "Asynchronous" unwind tables (instr precise)
255    Async = 2,
256}
257
258/// Must match the layout of `llvm::FramePointerKind`.
259#[repr(C)]
260#[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) -> Self { *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::debug_c_like_enum_write_str(f,
            "None NonLeaf All Reserved NonLeafNoReserve",
            match self {
                FramePointerKind::None => 0usize,
                FramePointerKind::NonLeaf => 5usize,
                FramePointerKind::All => 13usize,
                FramePointerKind::Reserved => 17usize,
                FramePointerKind::NonLeafNoReserve => 26usize,
            })
    }
}Debug)]
261#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM")]
262pub(crate) enum FramePointerKind {
263    None = 0,
264    NonLeaf = 1,
265    All = 2,
266    Reserved = 3,
267    NonLeafNoReserve = 4,
268}
269
270/// Must match the layout of `LLVMRustAttributeKind`.
271/// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
272/// though it is not ABI compatible (since it's a C++ enum)
273#[repr(C)]
274#[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) -> Self { *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::debug_c_like_enum_write_str(f,
            "AlwaysInline ByVal Cold InlineHint MinSize Naked NoAlias CapturesAddress NoInline NonNull NoRedZone NoReturn NoUnwind OptimizeForSize ReadOnly SExt StructRet UWTable ZExt InReg SanitizeThread SanitizeAddress SanitizeMemory NonLazyBind OptimizeNone ReadNone SanitizeHWAddress WillReturn StackProtectReq StackProtectStrong StackProtect NoUndef SanitizeMemTag NoCfCheck ShadowCallStack AllocSize AllocatedPointer AllocAlign SanitizeSafeStack FnRetThunkExtern Writable DeadOnUnwind DeadOnReturn CapturesReadOnly CapturesNone SanitizeRealtimeNonblocking SanitizeRealtimeBlocking Convergent NoFree",
            match self {
                AttributeKind::AlwaysInline => 0usize,
                AttributeKind::ByVal => 13usize,
                AttributeKind::Cold => 19usize,
                AttributeKind::InlineHint => 24usize,
                AttributeKind::MinSize => 35usize,
                AttributeKind::Naked => 43usize,
                AttributeKind::NoAlias => 49usize,
                AttributeKind::CapturesAddress => 57usize,
                AttributeKind::NoInline => 73usize,
                AttributeKind::NonNull => 82usize,
                AttributeKind::NoRedZone => 90usize,
                AttributeKind::NoReturn => 100usize,
                AttributeKind::NoUnwind => 109usize,
                AttributeKind::OptimizeForSize => 118usize,
                AttributeKind::ReadOnly => 134usize,
                AttributeKind::SExt => 143usize,
                AttributeKind::StructRet => 148usize,
                AttributeKind::UWTable => 158usize,
                AttributeKind::ZExt => 166usize,
                AttributeKind::InReg => 171usize,
                AttributeKind::SanitizeThread => 177usize,
                AttributeKind::SanitizeAddress => 192usize,
                AttributeKind::SanitizeMemory => 208usize,
                AttributeKind::NonLazyBind => 223usize,
                AttributeKind::OptimizeNone => 235usize,
                AttributeKind::ReadNone => 248usize,
                AttributeKind::SanitizeHWAddress => 257usize,
                AttributeKind::WillReturn => 275usize,
                AttributeKind::StackProtectReq => 286usize,
                AttributeKind::StackProtectStrong => 302usize,
                AttributeKind::StackProtect => 321usize,
                AttributeKind::NoUndef => 334usize,
                AttributeKind::SanitizeMemTag => 342usize,
                AttributeKind::NoCfCheck => 357usize,
                AttributeKind::ShadowCallStack => 367usize,
                AttributeKind::AllocSize => 383usize,
                AttributeKind::AllocatedPointer => 393usize,
                AttributeKind::AllocAlign => 410usize,
                AttributeKind::SanitizeSafeStack => 421usize,
                AttributeKind::FnRetThunkExtern => 439usize,
                AttributeKind::Writable => 456usize,
                AttributeKind::DeadOnUnwind => 465usize,
                AttributeKind::DeadOnReturn => 478usize,
                AttributeKind::CapturesReadOnly => 491usize,
                AttributeKind::CapturesNone => 508usize,
                AttributeKind::SanitizeRealtimeNonblocking => 521usize,
                AttributeKind::SanitizeRealtimeBlocking => 549usize,
                AttributeKind::Convergent => 574usize,
                AttributeKind::NoFree => 585usize,
            })
    }
}Debug)]
275#[expect(dead_code, reason = "Some variants are unused, but are kept to match the C++")]
276pub(crate) enum AttributeKind {
277    AlwaysInline = 0,
278    ByVal = 1,
279    Cold = 2,
280    InlineHint = 3,
281    MinSize = 4,
282    Naked = 5,
283    NoAlias = 6,
284    CapturesAddress = 7,
285    NoInline = 8,
286    NonNull = 9,
287    NoRedZone = 10,
288    NoReturn = 11,
289    NoUnwind = 12,
290    OptimizeForSize = 13,
291    ReadOnly = 14,
292    SExt = 15,
293    StructRet = 16,
294    UWTable = 17,
295    ZExt = 18,
296    InReg = 19,
297    SanitizeThread = 20,
298    SanitizeAddress = 21,
299    SanitizeMemory = 22,
300    NonLazyBind = 23,
301    OptimizeNone = 24,
302    ReadNone = 26,
303    SanitizeHWAddress = 28,
304    WillReturn = 29,
305    StackProtectReq = 30,
306    StackProtectStrong = 31,
307    StackProtect = 32,
308    NoUndef = 33,
309    SanitizeMemTag = 34,
310    NoCfCheck = 35,
311    ShadowCallStack = 36,
312    AllocSize = 37,
313    AllocatedPointer = 38,
314    AllocAlign = 39,
315    SanitizeSafeStack = 40,
316    FnRetThunkExtern = 41,
317    Writable = 42,
318    DeadOnUnwind = 43,
319    DeadOnReturn = 44,
320    CapturesReadOnly = 45,
321    CapturesNone = 46,
322    SanitizeRealtimeNonblocking = 47,
323    SanitizeRealtimeBlocking = 48,
324    Convergent = 49,
325    NoFree = 50,
326}
327
328/// LLVMIntPredicate
329#[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) -> Self { *self }
}Clone)]
330#[repr(C)]
331pub(crate) enum IntPredicate {
332    IntEQ = 32,
333    IntNE = 33,
334    IntUGT = 34,
335    IntUGE = 35,
336    IntULT = 36,
337    IntULE = 37,
338    IntSGT = 38,
339    IntSGE = 39,
340    IntSLT = 40,
341    IntSLE = 41,
342}
343
344/// LLVMRealPredicate
345#[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) -> Self { *self }
}Clone)]
346#[repr(C)]
347pub(crate) enum RealPredicate {
348    RealPredicateFalse = 0,
349    RealOEQ = 1,
350    RealOGT = 2,
351    RealOGE = 3,
352    RealOLT = 4,
353    RealOLE = 5,
354    RealONE = 6,
355    RealORD = 7,
356    RealUNO = 8,
357    RealUEQ = 9,
358    RealUGT = 10,
359    RealUGE = 11,
360    RealULT = 12,
361    RealULE = 13,
362    RealUNE = 14,
363    RealPredicateTrue = 15,
364}
365
366/// Must match the layout of `LLVMTypeKind`.
367///
368/// Use [`RawEnum<TypeKind>`] for values of `LLVMTypeKind` returned from LLVM,
369/// to avoid risk of UB if LLVM adds new enum values.
370///
371/// All of LLVM's variants should be declared here, even if no Rust-side code refers
372/// to them, because unknown variants will cause [`RawEnum::to_rust`] to panic.
373#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for TypeKind
    {
}
#[automatically_derived]impl ::core::cmp::PartialEq for TypeKind {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]impl ::core::fmt::Debug for TypeKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_c_like_enum_write_str(f,
            "Void Half Float Double X86_FP80 FP128 PPC_FP128 Label Integer Function Struct Array Pointer Vector Metadata Token ScalableVector BFloat X86_AMX",
            match self {
                TypeKind::Void => 0usize,
                TypeKind::Half => 5usize,
                TypeKind::Float => 10usize,
                TypeKind::Double => 16usize,
                TypeKind::X86_FP80 => 23usize,
                TypeKind::FP128 => 32usize,
                TypeKind::PPC_FP128 => 38usize,
                TypeKind::Label => 48usize,
                TypeKind::Integer => 54usize,
                TypeKind::Function => 62usize,
                TypeKind::Struct => 71usize,
                TypeKind::Array => 78usize,
                TypeKind::Pointer => 84usize,
                TypeKind::Vector => 92usize,
                TypeKind::Metadata => 99usize,
                TypeKind::Token => 108usize,
                TypeKind::ScalableVector => 114usize,
                TypeKind::BFloat => 129usize,
                TypeKind::X86_AMX => 136usize,
            })
    }
}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)]
374#[repr(C)]
375pub(crate) enum TypeKind {
376    Void = 0,
377    Half = 1,
378    Float = 2,
379    Double = 3,
380    X86_FP80 = 4,
381    FP128 = 5,
382    PPC_FP128 = 6,
383    Label = 7,
384    Integer = 8,
385    Function = 9,
386    Struct = 10,
387    Array = 11,
388    Pointer = 12,
389    Vector = 13,
390    Metadata = 14,
391    Token = 16,
392    ScalableVector = 17,
393    BFloat = 18,
394    X86_AMX = 19,
395}
396
397/// LLVMAtomicRmwBinOp
398#[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) -> Self { *self }
}Clone)]
399#[repr(C)]
400pub(crate) enum AtomicRmwBinOp {
401    AtomicXchg = 0,
402    AtomicAdd = 1,
403    AtomicSub = 2,
404    AtomicAnd = 3,
405    AtomicNand = 4,
406    AtomicOr = 5,
407    AtomicXor = 6,
408    AtomicMax = 7,
409    AtomicMin = 8,
410    AtomicUMax = 9,
411    AtomicUMin = 10,
412}
413
414/// LLVMAtomicOrdering
415#[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) -> Self { *self }
}Clone)]
416#[repr(C)]
417pub(crate) enum AtomicOrdering {
418    #[allow(dead_code)]
419    NotAtomic = 0,
420    #[allow(dead_code)]
421    Unordered = 1,
422    Monotonic = 2,
423    // Consume = 3,  // Not specified yet.
424    Acquire = 4,
425    Release = 5,
426    AcquireRelease = 6,
427    SequentiallyConsistent = 7,
428}
429
430/// LLVMRustFileType
431#[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) -> Self { *self }
}Clone)]
432#[repr(C)]
433pub(crate) enum FileType {
434    AssemblyFile,
435    ObjectFile,
436}
437
438/// Must match the layout of `LLVMInlineAsmDialect`.
439#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    AsmDialect {
}
#[automatically_derived]impl ::core::cmp::PartialEq for AsmDialect {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
440#[repr(C)]
441pub(crate) enum AsmDialect {
442    Att,
443    Intel,
444}
445
446/// LLVMRustCodeGenOptLevel
447#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    CodeGenOptLevel {
}
#[automatically_derived]impl ::core::cmp::PartialEq for CodeGenOptLevel {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
448#[repr(C)]
449pub(crate) enum CodeGenOptLevel {
450    None,
451    Less,
452    Default,
453    Aggressive,
454}
455
456/// LLVMRustPassBuilderOptLevel
457#[repr(C)]
458pub(crate) enum PassBuilderOptLevel {
459    O0,
460    O1,
461    O2,
462    O3,
463    Os,
464    Oz,
465}
466
467/// LLVMRustOptStage
468#[derive(#[automatically_derived]impl ::core::marker::StructuralPartialEq for OptStage
    {
}
#[automatically_derived]impl ::core::cmp::PartialEq for OptStage {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
469#[repr(C)]
470pub(crate) enum OptStage {
471    PreLinkNoLTO,
472    PreLinkThinLTO,
473    PreLinkFatLTO,
474    ThinLTO,
475    FatLTO,
476}
477
478/// LLVMRustSanitizerOptions
479#[repr(C)]
480pub(crate) struct SanitizerOptions {
481    pub sanitize_address: bool,
482    pub sanitize_address_recover: bool,
483    pub sanitize_cfi: bool,
484    pub sanitize_dataflow: bool,
485    pub sanitize_dataflow_abilist: *const *const c_char,
486    pub sanitize_dataflow_abilist_len: size_t,
487    pub sanitize_kcfi: bool,
488    pub sanitize_memory: bool,
489    pub sanitize_memory_recover: bool,
490    pub sanitize_memory_track_origins: c_int,
491    pub sanitize_realtime: bool,
492    pub sanitize_thread: bool,
493    pub sanitize_hwaddress: bool,
494    pub sanitize_hwaddress_recover: bool,
495    pub sanitize_kernel_address: bool,
496    pub sanitize_kernel_address_recover: bool,
497    pub sanitize_kernel_hwaddress: bool,
498    pub sanitize_kernel_hwaddress_recover: bool,
499}
500
501/// LLVMRustRelocModel
502#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    RelocModel {
}
#[automatically_derived]impl ::core::cmp::PartialEq for RelocModel {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
503#[repr(C)]
504pub(crate) enum RelocModel {
505    Static,
506    PIC,
507    DynamicNoPic,
508    ROPI,
509    RWPI,
510    ROPI_RWPI,
511}
512
513/// LLVMRustFloatABI
514#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for FloatAbi
    {
}
#[automatically_derived]impl ::core::cmp::PartialEq for FloatAbi {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
515#[repr(C)]
516pub(crate) enum FloatAbi {
517    Default,
518    Soft,
519    Hard,
520}
521
522/// LLVMRustCodeModel
523#[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) -> Self { *self }
}Clone)]
524#[repr(C)]
525pub(crate) enum CodeModel {
526    Tiny,
527    Small,
528    Kernel,
529    Medium,
530    Large,
531    None,
532}
533
534/// LLVMRustDiagnosticKind
535#[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) -> Self { *self }
}Clone)]
536#[repr(C)]
537#[allow(dead_code)] // Variants constructed by C++.
538pub(crate) enum DiagnosticKind {
539    Other,
540    InlineAsm,
541    StackSize,
542    DebugMetadataVersion,
543    SampleProfile,
544    OptimizationRemark,
545    OptimizationRemarkMissed,
546    OptimizationRemarkAnalysis,
547    OptimizationRemarkAnalysisFPCommute,
548    OptimizationRemarkAnalysisAliasing,
549    OptimizationRemarkOther,
550    OptimizationFailure,
551    PGOProfile,
552    Linker,
553    Unsupported,
554    SrcMgr,
555}
556
557/// LLVMDiagnosticSeverity
558#[derive(#[automatically_derived]#[allow(dead_code)]
impl ::core::marker::Copy for DiagnosticSeverity { }Copy, #[automatically_derived]#[doc(hidden)]#[allow(dead_code)]
unsafe impl ::core::clone::TrivialClone for DiagnosticSeverity { }
#[automatically_derived]#[allow(dead_code)]
impl ::core::clone::Clone for DiagnosticSeverity {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone)]
559#[repr(C)]
560#[allow(dead_code)] // Variants constructed by C++.
561pub(crate) enum DiagnosticSeverity {
562    Error,
563    Warning,
564    Remark,
565    Note,
566}
567
568unsafe extern "C" {
569    // LLVMRustThinLTOData
570    pub(crate) type ThinLTOData;
571}
572
573/// LLVMRustThinLTOModule
574#[repr(C)]
575pub(crate) struct ThinLTOModule {
576    pub identifier: *const c_char,
577    pub data: *const u8,
578    pub len: usize,
579}
580
581/// LLVMThreadLocalMode
582#[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) -> Self { *self }
}Clone)]
583#[repr(C)]
584pub(crate) enum ThreadLocalMode {
585    #[expect(dead_code)]
586    NotThreadLocal,
587    GeneralDynamic,
588    LocalDynamic,
589    InitialExec,
590    LocalExec,
591}
592
593/// LLVMRustChecksumKind
594#[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) -> Self { *self }
}Clone)]
595#[repr(C)]
596pub(crate) enum ChecksumKind {
597    None,
598    MD5,
599    SHA1,
600    SHA256,
601}
602
603/// LLVMRustMemoryEffects
604#[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) -> Self { *self }
}Clone)]
605#[repr(C)]
606pub(crate) enum MemoryEffects {
607    None,
608    ReadOnly,
609    InaccessibleMemOnly,
610    ReadOnlyNotPure,
611}
612
613/// LLVMOpcode
614#[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) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for Opcode {
}
#[automatically_derived]impl ::core::cmp::PartialEq for Opcode {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for Opcode { }Eq)]
615#[repr(C)]
616#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM-C")]
617pub(crate) enum Opcode {
618    Ret = 1,
619    Br = 2,
620    Switch = 3,
621    IndirectBr = 4,
622    Invoke = 5,
623    Unreachable = 7,
624    CallBr = 67,
625    FNeg = 66,
626    Add = 8,
627    FAdd = 9,
628    Sub = 10,
629    FSub = 11,
630    Mul = 12,
631    FMul = 13,
632    UDiv = 14,
633    SDiv = 15,
634    FDiv = 16,
635    URem = 17,
636    SRem = 18,
637    FRem = 19,
638    Shl = 20,
639    LShr = 21,
640    AShr = 22,
641    And = 23,
642    Or = 24,
643    Xor = 25,
644    Alloca = 26,
645    Load = 27,
646    Store = 28,
647    GetElementPtr = 29,
648    Trunc = 30,
649    ZExt = 31,
650    SExt = 32,
651    FPToUI = 33,
652    FPToSI = 34,
653    UIToFP = 35,
654    SIToFP = 36,
655    FPTrunc = 37,
656    FPExt = 38,
657    PtrToInt = 39,
658    IntToPtr = 40,
659    BitCast = 41,
660    AddrSpaceCast = 60,
661    ICmp = 42,
662    FCmp = 43,
663    PHI = 44,
664    Call = 45,
665    Select = 46,
666    UserOp1 = 47,
667    UserOp2 = 48,
668    VAArg = 49,
669    ExtractElement = 50,
670    InsertElement = 51,
671    ShuffleVector = 52,
672    ExtractValue = 53,
673    InsertValue = 54,
674    Freeze = 68,
675    Fence = 55,
676    AtomicCmpXchg = 56,
677    AtomicRMW = 57,
678    Resume = 58,
679    LandingPad = 59,
680    CleanupRet = 61,
681    CatchRet = 62,
682    CatchPad = 63,
683    CleanupPad = 64,
684    CatchSwitch = 65,
685}
686
687/// Must match the layout of `LLVMRustCompressionKind`.
688#[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) -> Self { *self }
}Clone)]
689#[repr(C)]
690pub(crate) enum CompressionKind {
691    None = 0,
692    Zlib = 1,
693    Zstd = 2,
694}
695
696unsafe extern "C" {
697    type Opaque;
698}
699#[repr(C)]
700struct InvariantOpaque<'a> {
701    _marker: PhantomData<&'a mut &'a ()>,
702    _opaque: Opaque,
703}
704
705// Opaque pointer types
706
707unsafe extern "C" {
708    pub(crate) type Type;
709    pub(crate) type Value;
710    pub(crate) type ConstantInt;
711    pub(crate) type Attribute;
712    pub(crate) type Metadata;
713    pub(crate) type BasicBlock;
714    pub(crate) type Comdat;
715    /// `&'ll DbgRecord` represents `LLVMDbgRecordRef`.
716    pub(crate) type DbgRecord;
717}
718#[repr(C)]
719pub(crate) struct Builder<'a>(InvariantOpaque<'a>);
720unsafe extern "C" {
721    pub type TargetMachine;
722}
723unsafe extern "C" {
724    pub(crate) type MCSubtargetInfo;
725    pub(crate) type Twine;
726    pub(crate) type DiagnosticInfo;
727    pub(crate) type SMDiagnostic;
728}
729/// Opaque pointee of `LLVMOperandBundleRef`.
730#[repr(C)]
731pub(crate) struct OperandBundle<'a>(InvariantOpaque<'a>);
732#[repr(C)]
733pub(crate) struct Linker<'a>(InvariantOpaque<'a>);
734
735unsafe extern "C" {
736    /// Corresponds to LLVM's `DiagnosticHandler`.
737    pub(crate) type DiagnosticHandler;
738}
739
740/// Must match the declaration of `LLVMRustDiagnosticHandlerCallback`.
741pub(crate) type DiagnosticHandlerCallback = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
742
743pub(crate) mod debuginfo {
744    use bitflags::bitflags;
745
746    use super::{InvariantOpaque, Metadata};
747
748    /// Opaque target type for references to an LLVM debuginfo builder.
749    ///
750    /// `&'_ DIBuilder<'ll>` corresponds to `LLVMDIBuilderRef`, which is the
751    /// LLVM-C wrapper for `DIBuilder *`.
752    ///
753    /// Debuginfo builders are created and destroyed during codegen, so the
754    /// builder reference typically has a shorter lifetime than the LLVM
755    /// session (`'ll`) that it participates in.
756    #[repr(C)]
757    pub(crate) struct DIBuilder<'ll>(InvariantOpaque<'ll>);
758
759    pub(crate) type DIDescriptor = Metadata;
760    pub(crate) type DILocation = Metadata;
761    pub(crate) type DIScope = DIDescriptor;
762    pub(crate) type DIFile = DIScope;
763    pub(crate) type DILexicalBlock = DIScope;
764    pub(crate) type DISubprogram = DIScope;
765    pub(crate) type DIType = DIDescriptor;
766    pub(crate) type DIBasicType = DIType;
767    pub(crate) type DIDerivedType = DIType;
768    pub(crate) type DICompositeType = DIDerivedType;
769    pub(crate) type DIVariable = DIDescriptor;
770    pub(crate) type DIArray = DIDescriptor;
771    pub(crate) type DITemplateTypeParameter = DIDescriptor;
772
773    #[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) -> Self {
        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() -> Self { 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) -> Self {
                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: &Self) -> 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: &Self)
                -> ::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: &Self) -> ::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! {
774        /// Must match the layout of `LLVMDIFlags` in the LLVM-C API.
775        ///
776        /// Each value declared here must also be covered by the static
777        /// assertions in `RustWrapper.cpp` used by `fromRust(LLVMDIFlags)`.
778        #[repr(transparent)]
779        #[derive(Clone, Copy, Default)]
780        pub(crate) struct DIFlags: u32 {
781            const FlagZero                = 0;
782            const FlagPrivate             = 1;
783            const FlagProtected           = 2;
784            const FlagPublic              = 3;
785            const FlagFwdDecl             = (1 << 2);
786            const FlagAppleBlock          = (1 << 3);
787            const FlagReservedBit4        = (1 << 4);
788            const FlagVirtual             = (1 << 5);
789            const FlagArtificial          = (1 << 6);
790            const FlagExplicit            = (1 << 7);
791            const FlagPrototyped          = (1 << 8);
792            const FlagObjcClassComplete   = (1 << 9);
793            const FlagObjectPointer       = (1 << 10);
794            const FlagVector              = (1 << 11);
795            const FlagStaticMember        = (1 << 12);
796            const FlagLValueReference     = (1 << 13);
797            const FlagRValueReference     = (1 << 14);
798            const FlagReserved            = (1 << 15);
799            const FlagSingleInheritance   = (1 << 16);
800            const FlagMultipleInheritance = (2 << 16);
801            const FlagVirtualInheritance  = (3 << 16);
802            const FlagIntroducedVirtual   = (1 << 18);
803            const FlagBitField            = (1 << 19);
804            const FlagNoReturn            = (1 << 20);
805            // The bit at (1 << 21) is unused, but was `LLVMDIFlagMainSubprogram`.
806            const FlagTypePassByValue     = (1 << 22);
807            const FlagTypePassByReference = (1 << 23);
808            const FlagEnumClass           = (1 << 24);
809            const FlagThunk               = (1 << 25);
810            const FlagNonTrivial          = (1 << 26);
811            const FlagBigEndian           = (1 << 27);
812            const FlagLittleEndian        = (1 << 28);
813        }
814    }
815
816    // These values **must** match with LLVMRustDISPFlags!!
817    #[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) -> Self {
        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() -> Self { 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) -> Self {
                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: &Self) -> 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: &Self)
                -> ::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: &Self) -> ::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! {
818        #[repr(transparent)]
819        #[derive(Clone, Copy, Default)]
820        pub(crate) struct DISPFlags: u32 {
821            const SPFlagZero              = 0;
822            const SPFlagVirtual           = 1;
823            const SPFlagPureVirtual       = 2;
824            const SPFlagLocalToUnit       = (1 << 2);
825            const SPFlagDefinition        = (1 << 3);
826            const SPFlagOptimized         = (1 << 4);
827            const SPFlagMainSubprogram    = (1 << 5);
828        }
829    }
830
831    /// LLVMRustDebugEmissionKind
832    #[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) -> Self { *self }
}Clone)]
833    #[repr(C)]
834    pub(crate) enum DebugEmissionKind {
835        NoDebug,
836        FullDebug,
837        LineTablesOnly,
838        DebugDirectivesOnly,
839    }
840
841    /// LLVMRustDebugNameTableKind
842    #[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for DebugNameTableKind {
}
#[automatically_derived]impl ::core::clone::Clone for DebugNameTableKind {
    #[inline]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for DebugNameTableKind { }Copy)]
843    #[repr(C)]
844    pub(crate) enum DebugNameTableKind {
845        Default,
846        #[expect(dead_code)]
847        Gnu,
848        None,
849    }
850}
851
852// These values **must** match with LLVMRustAllocKindFlags
853#[repr(transparent)]
pub(crate) struct AllocKindFlags(<AllocKindFlags as
    ::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]impl ::core::default::Default for AllocKindFlags {
    #[inline]
    fn default() -> Self {
        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) -> Self {
                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: &Self) -> 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: &Self)
                -> ::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: &Self) -> ::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! {
854    #[repr(transparent)]
855    #[derive(Default)]
856    pub(crate) struct AllocKindFlags : u64 {
857        const Unknown = 0;
858        const Alloc = 1;
859        const Realloc = 1 << 1;
860        const Free = 1 << 2;
861        const Uninitialized = 1 << 3;
862        const Zeroed = 1 << 4;
863        const Aligned = 1 << 5;
864    }
865}
866
867// These values **must** match with LLVMGEPNoWrapFlags
868#[repr(transparent)]
pub struct GEPNoWrapFlags(<GEPNoWrapFlags as
    ::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]impl ::core::default::Default for GEPNoWrapFlags {
    #[inline]
    fn default() -> Self {
        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) -> Self {
                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: &Self) -> 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: &Self)
                -> ::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: &Self) -> ::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! {
869    #[repr(transparent)]
870    #[derive(Default)]
871    pub struct GEPNoWrapFlags : c_uint {
872        const InBounds = 1 << 0;
873        const NUSW = 1 << 1;
874        const NUW = 1 << 2;
875    }
876}
877
878unsafe extern "C" {
879    pub(crate) type Buffer;
880}
881
882pub(crate) type SelfProfileBeforePassCallback =
883    unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
884pub(crate) type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
885
886pub(crate) type GetSymbolsCallback =
887    unsafe extern "C" fn(*mut c_void, *const c_char) -> *mut c_void;
888pub(crate) type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) -> *mut c_void;
889
890unsafe extern "C" {
891    // Create and destroy contexts.
892    pub(crate) fn LLVMContextCreate() -> ptr::NonNull<ContextRaw>;
893    pub(crate) fn LLVMContextDispose(C: ptr::NonNull<ContextRaw>);
894    pub(crate) fn LLVMContextSetDiscardValueNames<'ll>(C: Context<'ll>, Discard: Bool);
895    pub(crate) fn LLVMGetMDKindIDInContext<'ll>(
896        C: Context<'ll>,
897        Name: *const c_uchar, // See "PTR_LEN_STR".
898        SLen: c_uint,
899    ) -> MetadataKindId;
900
901    /// Gets the actual version of LLVM that we are linked to at runtime.
902    ///
903    /// # Safety
904    /// Can be called without initializing LLVM.
905    pub(crate) safe fn LLVMGetVersion(major: &mut c_uint, minor: &mut c_uint, patch: &mut c_uint);
906
907    pub(crate) fn LLVMDisposeTargetMachine(T: ptr::NonNull<TargetMachine>);
908
909    // Create modules.
910    pub(crate) fn LLVMModuleCreateWithNameInContext<'ll>(
911        ModuleID: *const c_char,
912        C: Context<'ll>,
913    ) -> Module<'ll>;
914    pub(crate) safe fn LLVMCloneModule<'ll>(M: Module<'ll>) -> Module<'ll>;
915
916    /// Data layout. See Module::getDataLayout.
917    pub(crate) fn LLVMGetDataLayoutStr<'ll>(M: Module<'ll>) -> *const c_char;
918    pub(crate) fn LLVMSetDataLayout<'ll>(M: Module<'ll>, Triple: *const c_char);
919
920    /// Create the specified uniqued inline asm string. See `InlineAsm::get()`.
921    pub(crate) fn LLVMGetInlineAsm<'ll>(
922        Ty: &'ll Type,
923        AsmString: *const c_uchar, // See "PTR_LEN_STR".
924        AsmStringSize: size_t,
925        Constraints: *const c_uchar, // See "PTR_LEN_STR".
926        ConstraintsSize: size_t,
927        HasSideEffects: llvm::Bool,
928        IsAlignStack: llvm::Bool,
929        Dialect: AsmDialect,
930        CanThrow: llvm::Bool,
931    ) -> &'ll Value;
932
933    pub(crate) safe fn LLVMGetTypeKind(Ty: &Type) -> RawEnum<TypeKind>;
934
935    // Operations on integer types
936    pub(crate) fn LLVMInt1TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
937    pub(crate) fn LLVMInt8TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
938    pub(crate) fn LLVMInt16TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
939    pub(crate) fn LLVMInt32TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
940    pub(crate) fn LLVMInt64TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
941    pub(crate) safe fn LLVMIntTypeInContext<'ll>(C: Context<'ll>, NumBits: c_uint) -> &'ll Type;
942
943    pub(crate) fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
944
945    // Operations on real types
946    pub(crate) fn LLVMHalfTypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
947    pub(crate) fn LLVMFloatTypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
948    pub(crate) fn LLVMDoubleTypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
949    pub(crate) fn LLVMFP128TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
950
951    // Operations on non-IEEE real types
952    pub(crate) fn LLVMBFloatTypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
953    pub(crate) fn LLVMPPCFP128TypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
954
955    // Operations on function types
956    pub(crate) fn LLVMFunctionType<'a>(
957        ReturnType: &'a Type,
958        ParamTypes: *const &'a Type,
959        ParamCount: c_uint,
960        IsVarArg: Bool,
961    ) -> &'a Type;
962    pub(crate) fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
963    pub(crate) fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
964    pub(crate) fn LLVMGetReturnType(FunctionTy: &Type) -> &Type;
965    pub(crate) fn LLVMIsFunctionVarArg(FunctionTy: &Type) -> Bool;
966
967    // Operations on struct types
968    pub(crate) fn LLVMStructTypeInContext<'ll>(
969        C: Context<'ll>,
970        ElementTypes: *const &'ll Type,
971        ElementCount: c_uint,
972        Packed: Bool,
973    ) -> &'ll Type;
974
975    // Operations on array, pointer, and vector types (sequence types)
976    pub(crate) safe fn LLVMPointerTypeInContext<'ll>(
977        C: Context<'ll>,
978        AddressSpace: c_uint,
979    ) -> &'ll Type;
980    pub(crate) fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
981    pub(crate) fn LLVMScalableVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
982
983    pub(crate) fn LLVMGetElementType(Ty: &Type) -> &Type;
984    pub(crate) fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
985
986    // Operations on other types
987    pub(crate) fn LLVMVoidTypeInContext<'ll>(C: Context<'ll>) -> &'ll Type;
988
989    // Operations on all values
990    pub(crate) fn LLVMTypeOf(Val: &Value) -> &Type;
991    pub(crate) fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
992    pub(crate) fn LLVMSetValueName2(
993        Val: &Value,
994        Name: *const c_uchar, // See "PTR_LEN_STR".
995        NameLen: size_t,
996    );
997    pub(crate) fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
998    pub(crate) safe fn LLVMGetMetadata<'a>(
999        Val: &'a Value,
1000        KindID: MetadataKindId,
1001    ) -> Option<&'a Value>;
1002    pub(crate) safe fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: MetadataKindId, Node: &'a Value);
1003    pub(crate) fn LLVMGlobalSetMetadata<'a>(
1004        Val: &'a Value,
1005        KindID: MetadataKindId,
1006        Metadata: &'a Metadata,
1007    );
1008    pub(crate) fn LLVMGlobalAddMetadata<'ll>(
1009        Global: &'ll Value,
1010        Kind: MetadataKindId,
1011        MD: &'ll Metadata,
1012    );
1013    pub(crate) safe fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1014
1015    // Operations on constants of any type
1016    pub(crate) fn LLVMConstNull(Ty: &Type) -> &Value;
1017    pub(crate) fn LLVMGetUndef(Ty: &Type) -> &Value;
1018    pub(crate) fn LLVMGetPoison(Ty: &Type) -> &Value;
1019
1020    // Operations on metadata
1021    pub(crate) fn LLVMMDStringInContext2<'ll>(
1022        C: Context<'ll>,
1023        Str: *const c_uchar, // See "PTR_LEN_STR".
1024        SLen: size_t,
1025    ) -> &'ll Metadata;
1026    pub(crate) fn LLVMMDNodeInContext2<'ll>(
1027        C: Context<'ll>,
1028        Vals: *const &'ll Metadata,
1029        Count: size_t,
1030    ) -> &'ll Metadata;
1031    pub(crate) fn LLVMAddNamedMetadataOperand<'ll>(
1032        M: Module<'ll>,
1033        Name: *const c_char,
1034        Val: &'ll Value,
1035    );
1036    pub(crate) fn LLVMReplaceMDNodeOperandWith(Val: &Value, index: u32, replacement: &Metadata);
1037
1038    // Operations on scalar constants
1039    pub(crate) fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1040    pub(crate) fn LLVMConstIntOfArbitraryPrecision(
1041        IntTy: &Type,
1042        Wn: c_uint,
1043        Ws: *const u64,
1044    ) -> &Value;
1045    pub(crate) fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1046
1047    // Operations on composite constants
1048    pub(crate) fn LLVMConstArray2<'a>(
1049        ElementTy: &'a Type,
1050        ConstantVals: *const &'a Value,
1051        Length: u64,
1052    ) -> &'a Value;
1053    pub(crate) fn LLVMArrayType2(ElementType: &Type, ElementCount: u64) -> &Type;
1054    pub(crate) fn LLVMConstStringInContext2<'ll>(
1055        C: Context<'ll>,
1056        Str: *const c_uchar, // See "PTR_LEN_STR".
1057        Length: size_t,
1058        DontNullTerminate: Bool,
1059    ) -> &'ll Value;
1060    pub(crate) fn LLVMConstStructInContext<'ll>(
1061        C: Context<'ll>,
1062        ConstantVals: *const &'ll Value,
1063        Count: c_uint,
1064        Packed: Bool,
1065    ) -> &'ll Value;
1066    pub(crate) fn LLVMConstNamedStruct<'a>(
1067        StructTy: &'a Type,
1068        ConstantVals: *const &'a Value,
1069        Count: c_uint,
1070    ) -> &'a Value;
1071    pub(crate) fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1072
1073    // Constant expressions
1074    pub(crate) fn LLVMConstInBoundsGEP2<'a>(
1075        ty: &'a Type,
1076        ConstantVal: &'a Value,
1077        ConstantIndices: *const &'a Value,
1078        NumIndices: c_uint,
1079    ) -> &'a Value;
1080    pub(crate) fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1081    pub(crate) fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1082    pub(crate) fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1083    pub(crate) fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1084    pub(crate) fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1085    pub(crate) fn LLVMGetConstOpcode(ConstantVal: &Value) -> Opcode;
1086    pub(crate) fn LLVMIsAConstantExpr(Val: &Value) -> Option<&Value>;
1087
1088    // Operations on global variables, functions, and aliases (globals)
1089    pub(crate) fn LLVMIsDeclaration(Global: &Value) -> Bool;
1090    pub(crate) fn LLVMGetLinkage(Global: &Value) -> RawEnum<Linkage>;
1091    pub(crate) fn LLVMSetLinkage(Global: &Value, RustLinkage: Linkage);
1092    pub(crate) fn LLVMSetSection(Global: &Value, Section: *const c_char);
1093    pub(crate) fn LLVMGetVisibility(Global: &Value) -> RawEnum<Visibility>;
1094    pub(crate) fn LLVMSetVisibility(Global: &Value, Viz: Visibility);
1095    pub(crate) fn LLVMGetAlignment(Global: &Value) -> c_uint;
1096    pub(crate) fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1097    pub(crate) fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1098    pub(crate) fn LLVMGlobalGetValueType(Global: &Value) -> &Type;
1099
1100    // Operations on global variables
1101    pub(crate) safe fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1102    pub(crate) fn LLVMAddGlobal<'ll>(
1103        M: Module<'ll>,
1104        Ty: &'ll Type,
1105        Name: *const c_char,
1106    ) -> &'ll Value;
1107    pub(crate) fn LLVMGetNamedGlobal<'ll>(
1108        M: Module<'ll>,
1109        Name: *const c_char,
1110    ) -> Option<&'ll Value>;
1111    pub(crate) fn LLVMGetFirstGlobal<'ll>(M: Module<'ll>) -> Option<&'ll Value>;
1112    pub(crate) fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1113    pub(crate) fn LLVMDeleteGlobal(GlobalVar: &Value);
1114    pub(crate) safe fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1115    pub(crate) fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1116    pub(crate) safe fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1117    pub(crate) fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1118    pub(crate) safe fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1119    pub(crate) safe fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1120    pub(crate) safe fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1121    pub(crate) safe fn LLVMSetTailCallKind(CallInst: &Value, kind: TailCallKind);
1122    pub(crate) safe fn LLVMSetExternallyInitialized(GlobalVar: &Value, IsExtInit: Bool);
1123
1124    // Operations on global aliases
1125    pub(crate) fn LLVMAddAlias2<'ll>(
1126        M: Module<'ll>,
1127        ValueTy: &Type,
1128        AddressSpace: c_uint,
1129        Aliasee: &Value,
1130        Name: *const c_char,
1131    ) -> &'ll Value;
1132    pub(crate) fn LLVMGetFirstGlobalAlias<'ll>(M: Module<'ll>) -> Option<&'ll Value>;
1133    pub(crate) fn LLVMGetNextGlobalAlias(GlobalAlias: &Value) -> Option<&Value>;
1134
1135    // Operations on attributes
1136    pub(crate) fn LLVMCreateStringAttribute<'ll>(
1137        C: Context<'ll>,
1138        Name: *const c_uchar, // See "PTR_LEN_STR".
1139        NameLen: c_uint,
1140        Value: *const c_uchar, // See "PTR_LEN_STR".
1141        ValueLen: c_uint,
1142    ) -> &'ll Attribute;
1143
1144    // Operations on functions
1145    pub(crate) fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1146    pub(crate) fn LLVMAddFunction<'ll>(
1147        Mod: Module<'ll>,
1148        Name: *const c_char,
1149        FunctionTy: &'ll Type,
1150    ) -> &'ll Value;
1151    pub(crate) fn LLVMDeleteFunction(Fn: &Value);
1152    pub(crate) fn LLVMGetOrInsertFunction<'ll>(
1153        M: Module<'ll>,
1154        Name: *const c_uchar, // See "PTR_LEN_STR".
1155        NameLen: size_t,
1156        FunctionTy: &'ll Type,
1157    ) -> &'ll Value;
1158
1159    // Operations about llvm intrinsics
1160    pub(crate) fn LLVMLookupIntrinsicID(
1161        Name: *const c_uchar, // See "PTR_LEN_STR".
1162        NameLen: size_t,
1163    ) -> c_uint;
1164    pub(crate) fn LLVMIntrinsicIsOverloaded(ID: NonZero<c_uint>) -> Bool;
1165    pub(crate) fn LLVMGetIntrinsicDeclaration<'ll>(
1166        Mod: Module<'ll>,
1167        ID: NonZero<c_uint>,
1168        ParamTypes: *const &'ll Type,
1169        ParamCount: size_t,
1170    ) -> &'ll Value;
1171    pub(crate) fn LLVMRustUpgradeIntrinsicFunction<'a>(
1172        Fn: &'a Value,
1173        NewFn: &mut Option<&'a Value>,
1174    ) -> bool;
1175    pub(crate) fn LLVMRustIsTargetIntrinsic(ID: NonZero<c_uint>) -> bool;
1176
1177    // Operations on parameters
1178    pub(crate) fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1179    pub(crate) safe fn LLVMCountParams(Fn: &Value) -> c_uint;
1180    pub(crate) fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1181
1182    // Operations on basic blocks
1183    pub(crate) fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1184    pub(crate) fn LLVMAppendBasicBlockInContext<'ll>(
1185        C: Context<'ll>,
1186        Fn: &'ll Value,
1187        Name: *const c_char,
1188    ) -> &'ll BasicBlock;
1189
1190    // Operations on instructions
1191    pub(crate) fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1192    pub(crate) fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1193    pub(crate) fn LLVMGetOperand(Val: &Value, Index: c_uint) -> Option<&Value>;
1194
1195    // Operations on call sites
1196    pub(crate) fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1197
1198    // Operations on load/store instructions (only)
1199    pub(crate) fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1200    pub(crate) fn LLVMSetOrdering(MemoryAccessInst: &Value, Ordering: AtomicOrdering);
1201
1202    // Operations on phi nodes
1203    pub(crate) fn LLVMAddIncoming<'a>(
1204        PhiNode: &'a Value,
1205        IncomingValues: *const &'a Value,
1206        IncomingBlocks: *const &'a BasicBlock,
1207        Count: c_uint,
1208    );
1209
1210    // Instruction builders
1211    pub(crate) fn LLVMCreateBuilderForModule<'ll>(M: Module<'ll>) -> ptr::NonNull<Builder<'ll>>;
1212    pub(crate) fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1213    pub(crate) fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1214    pub(crate) fn LLVMDisposeBuilder<'ll>(Builder: ptr::NonNull<Builder<'ll>>);
1215
1216    // Metadata
1217    pub(crate) fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: *const Metadata);
1218    pub(crate) fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>;
1219
1220    // Terminators
1221    pub(crate) safe fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1222    pub(crate) fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1223    pub(crate) fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1224    pub(crate) fn LLVMBuildCondBr<'a>(
1225        B: &Builder<'a>,
1226        If: &'a Value,
1227        Then: &'a BasicBlock,
1228        Else: &'a BasicBlock,
1229    ) -> &'a Value;
1230    pub(crate) fn LLVMBuildSwitch<'a>(
1231        B: &Builder<'a>,
1232        V: &'a Value,
1233        Else: &'a BasicBlock,
1234        NumCases: c_uint,
1235    ) -> &'a Value;
1236    pub(crate) fn LLVMBuildLandingPad<'a>(
1237        B: &Builder<'a>,
1238        Ty: &'a Type,
1239        PersFn: Option<&'a Value>,
1240        NumClauses: c_uint,
1241        Name: *const c_char,
1242    ) -> &'a Value;
1243    pub(crate) fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1244    pub(crate) fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1245
1246    pub(crate) fn LLVMBuildCleanupPad<'a>(
1247        B: &Builder<'a>,
1248        ParentPad: Option<&'a Value>,
1249        Args: *const &'a Value,
1250        NumArgs: c_uint,
1251        Name: *const c_char,
1252    ) -> Option<&'a Value>;
1253    pub(crate) fn LLVMBuildCleanupRet<'a>(
1254        B: &Builder<'a>,
1255        CleanupPad: &'a Value,
1256        BB: Option<&'a BasicBlock>,
1257    ) -> Option<&'a Value>;
1258    pub(crate) fn LLVMBuildCatchPad<'a>(
1259        B: &Builder<'a>,
1260        ParentPad: &'a Value,
1261        Args: *const &'a Value,
1262        NumArgs: c_uint,
1263        Name: *const c_char,
1264    ) -> Option<&'a Value>;
1265    pub(crate) fn LLVMBuildCatchRet<'a>(
1266        B: &Builder<'a>,
1267        CatchPad: &'a Value,
1268        BB: &'a BasicBlock,
1269    ) -> Option<&'a Value>;
1270    pub(crate) fn LLVMBuildCatchSwitch<'a>(
1271        Builder: &Builder<'a>,
1272        ParentPad: Option<&'a Value>,
1273        UnwindBB: Option<&'a BasicBlock>,
1274        NumHandlers: c_uint,
1275        Name: *const c_char,
1276    ) -> Option<&'a Value>;
1277    pub(crate) fn LLVMAddHandler<'a>(CatchSwitch: &'a Value, Dest: &'a BasicBlock);
1278    pub(crate) fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1279
1280    // Add a case to the switch instruction
1281    pub(crate) fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1282
1283    // Add a clause to the landing pad instruction
1284    pub(crate) fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1285
1286    // Set the cleanup on a landing pad instruction
1287    pub(crate) fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1288
1289    // Arithmetic
1290    pub(crate) fn LLVMBuildAdd<'a>(
1291        B: &Builder<'a>,
1292        LHS: &'a Value,
1293        RHS: &'a Value,
1294        Name: *const c_char,
1295    ) -> &'a Value;
1296    pub(crate) fn LLVMBuildFAdd<'a>(
1297        B: &Builder<'a>,
1298        LHS: &'a Value,
1299        RHS: &'a Value,
1300        Name: *const c_char,
1301    ) -> &'a Value;
1302    pub(crate) fn LLVMBuildSub<'a>(
1303        B: &Builder<'a>,
1304        LHS: &'a Value,
1305        RHS: &'a Value,
1306        Name: *const c_char,
1307    ) -> &'a Value;
1308    pub(crate) fn LLVMBuildFSub<'a>(
1309        B: &Builder<'a>,
1310        LHS: &'a Value,
1311        RHS: &'a Value,
1312        Name: *const c_char,
1313    ) -> &'a Value;
1314    pub(crate) fn LLVMBuildMul<'a>(
1315        B: &Builder<'a>,
1316        LHS: &'a Value,
1317        RHS: &'a Value,
1318        Name: *const c_char,
1319    ) -> &'a Value;
1320    pub(crate) fn LLVMBuildFMul<'a>(
1321        B: &Builder<'a>,
1322        LHS: &'a Value,
1323        RHS: &'a Value,
1324        Name: *const c_char,
1325    ) -> &'a Value;
1326    pub(crate) fn LLVMBuildUDiv<'a>(
1327        B: &Builder<'a>,
1328        LHS: &'a Value,
1329        RHS: &'a Value,
1330        Name: *const c_char,
1331    ) -> &'a Value;
1332    pub(crate) fn LLVMBuildExactUDiv<'a>(
1333        B: &Builder<'a>,
1334        LHS: &'a Value,
1335        RHS: &'a Value,
1336        Name: *const c_char,
1337    ) -> &'a Value;
1338    pub(crate) fn LLVMBuildSDiv<'a>(
1339        B: &Builder<'a>,
1340        LHS: &'a Value,
1341        RHS: &'a Value,
1342        Name: *const c_char,
1343    ) -> &'a Value;
1344    pub(crate) fn LLVMBuildExactSDiv<'a>(
1345        B: &Builder<'a>,
1346        LHS: &'a Value,
1347        RHS: &'a Value,
1348        Name: *const c_char,
1349    ) -> &'a Value;
1350    pub(crate) fn LLVMBuildFDiv<'a>(
1351        B: &Builder<'a>,
1352        LHS: &'a Value,
1353        RHS: &'a Value,
1354        Name: *const c_char,
1355    ) -> &'a Value;
1356    pub(crate) fn LLVMBuildURem<'a>(
1357        B: &Builder<'a>,
1358        LHS: &'a Value,
1359        RHS: &'a Value,
1360        Name: *const c_char,
1361    ) -> &'a Value;
1362    pub(crate) fn LLVMBuildSRem<'a>(
1363        B: &Builder<'a>,
1364        LHS: &'a Value,
1365        RHS: &'a Value,
1366        Name: *const c_char,
1367    ) -> &'a Value;
1368    pub(crate) fn LLVMBuildFRem<'a>(
1369        B: &Builder<'a>,
1370        LHS: &'a Value,
1371        RHS: &'a Value,
1372        Name: *const c_char,
1373    ) -> &'a Value;
1374    pub(crate) fn LLVMBuildShl<'a>(
1375        B: &Builder<'a>,
1376        LHS: &'a Value,
1377        RHS: &'a Value,
1378        Name: *const c_char,
1379    ) -> &'a Value;
1380    pub(crate) fn LLVMBuildLShr<'a>(
1381        B: &Builder<'a>,
1382        LHS: &'a Value,
1383        RHS: &'a Value,
1384        Name: *const c_char,
1385    ) -> &'a Value;
1386    pub(crate) fn LLVMBuildAShr<'a>(
1387        B: &Builder<'a>,
1388        LHS: &'a Value,
1389        RHS: &'a Value,
1390        Name: *const c_char,
1391    ) -> &'a Value;
1392    pub(crate) fn LLVMBuildNSWAdd<'a>(
1393        B: &Builder<'a>,
1394        LHS: &'a Value,
1395        RHS: &'a Value,
1396        Name: *const c_char,
1397    ) -> &'a Value;
1398    pub(crate) fn LLVMBuildNUWAdd<'a>(
1399        B: &Builder<'a>,
1400        LHS: &'a Value,
1401        RHS: &'a Value,
1402        Name: *const c_char,
1403    ) -> &'a Value;
1404    pub(crate) fn LLVMBuildNSWSub<'a>(
1405        B: &Builder<'a>,
1406        LHS: &'a Value,
1407        RHS: &'a Value,
1408        Name: *const c_char,
1409    ) -> &'a Value;
1410    pub(crate) fn LLVMBuildNUWSub<'a>(
1411        B: &Builder<'a>,
1412        LHS: &'a Value,
1413        RHS: &'a Value,
1414        Name: *const c_char,
1415    ) -> &'a Value;
1416    pub(crate) fn LLVMBuildNSWMul<'a>(
1417        B: &Builder<'a>,
1418        LHS: &'a Value,
1419        RHS: &'a Value,
1420        Name: *const c_char,
1421    ) -> &'a Value;
1422    pub(crate) fn LLVMBuildNUWMul<'a>(
1423        B: &Builder<'a>,
1424        LHS: &'a Value,
1425        RHS: &'a Value,
1426        Name: *const c_char,
1427    ) -> &'a Value;
1428    pub(crate) fn LLVMBuildAnd<'a>(
1429        B: &Builder<'a>,
1430        LHS: &'a Value,
1431        RHS: &'a Value,
1432        Name: *const c_char,
1433    ) -> &'a Value;
1434    pub(crate) fn LLVMBuildOr<'a>(
1435        B: &Builder<'a>,
1436        LHS: &'a Value,
1437        RHS: &'a Value,
1438        Name: *const c_char,
1439    ) -> &'a Value;
1440    pub(crate) fn LLVMBuildXor<'a>(
1441        B: &Builder<'a>,
1442        LHS: &'a Value,
1443        RHS: &'a Value,
1444        Name: *const c_char,
1445    ) -> &'a Value;
1446    pub(crate) fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
1447    -> &'a Value;
1448    pub(crate) fn LLVMBuildFNeg<'a>(
1449        B: &Builder<'a>,
1450        V: &'a Value,
1451        Name: *const c_char,
1452    ) -> &'a Value;
1453    pub(crate) fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
1454    -> &'a Value;
1455
1456    // Extra flags on arithmetic
1457    pub(crate) fn LLVMSetIsDisjoint(Instr: &Value, IsDisjoint: Bool);
1458    pub(crate) fn LLVMSetNUW(ArithInst: &Value, HasNUW: Bool);
1459    pub(crate) fn LLVMSetNSW(ArithInst: &Value, HasNSW: Bool);
1460
1461    // Memory
1462    pub(crate) fn LLVMBuildAlloca<'a>(
1463        B: &Builder<'a>,
1464        Ty: &'a Type,
1465        Name: *const c_char,
1466    ) -> &'a Value;
1467    pub(crate) fn LLVMBuildLoad2<'a>(
1468        B: &Builder<'a>,
1469        Ty: &'a Type,
1470        PointerVal: &'a Value,
1471        Name: *const c_char,
1472    ) -> &'a Value;
1473
1474    pub(crate) fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1475
1476    pub(crate) fn LLVMBuildGEPWithNoWrapFlags<'a>(
1477        B: &Builder<'a>,
1478        Ty: &'a Type,
1479        Pointer: &'a Value,
1480        Indices: *const &'a Value,
1481        NumIndices: c_uint,
1482        Name: *const c_char,
1483        Flags: GEPNoWrapFlags,
1484    ) -> &'a Value;
1485
1486    // Casts
1487    pub(crate) fn LLVMBuildTrunc<'a>(
1488        B: &Builder<'a>,
1489        Val: &'a Value,
1490        DestTy: &'a Type,
1491        Name: *const c_char,
1492    ) -> &'a Value;
1493    pub(crate) fn LLVMBuildZExt<'a>(
1494        B: &Builder<'a>,
1495        Val: &'a Value,
1496        DestTy: &'a Type,
1497        Name: *const c_char,
1498    ) -> &'a Value;
1499    pub(crate) fn LLVMBuildSExt<'a>(
1500        B: &Builder<'a>,
1501        Val: &'a Value,
1502        DestTy: &'a Type,
1503        Name: *const c_char,
1504    ) -> &'a Value;
1505    pub(crate) fn LLVMBuildFPToUI<'a>(
1506        B: &Builder<'a>,
1507        Val: &'a Value,
1508        DestTy: &'a Type,
1509        Name: *const c_char,
1510    ) -> &'a Value;
1511    pub(crate) fn LLVMBuildFPToSI<'a>(
1512        B: &Builder<'a>,
1513        Val: &'a Value,
1514        DestTy: &'a Type,
1515        Name: *const c_char,
1516    ) -> &'a Value;
1517    pub(crate) fn LLVMBuildUIToFP<'a>(
1518        B: &Builder<'a>,
1519        Val: &'a Value,
1520        DestTy: &'a Type,
1521        Name: *const c_char,
1522    ) -> &'a Value;
1523    pub(crate) fn LLVMBuildSIToFP<'a>(
1524        B: &Builder<'a>,
1525        Val: &'a Value,
1526        DestTy: &'a Type,
1527        Name: *const c_char,
1528    ) -> &'a Value;
1529    pub(crate) fn LLVMBuildFPTrunc<'a>(
1530        B: &Builder<'a>,
1531        Val: &'a Value,
1532        DestTy: &'a Type,
1533        Name: *const c_char,
1534    ) -> &'a Value;
1535    pub(crate) fn LLVMBuildFPExt<'a>(
1536        B: &Builder<'a>,
1537        Val: &'a Value,
1538        DestTy: &'a Type,
1539        Name: *const c_char,
1540    ) -> &'a Value;
1541    pub(crate) fn LLVMBuildPtrToInt<'a>(
1542        B: &Builder<'a>,
1543        Val: &'a Value,
1544        DestTy: &'a Type,
1545        Name: *const c_char,
1546    ) -> &'a Value;
1547    pub(crate) fn LLVMBuildIntToPtr<'a>(
1548        B: &Builder<'a>,
1549        Val: &'a Value,
1550        DestTy: &'a Type,
1551        Name: *const c_char,
1552    ) -> &'a Value;
1553    pub(crate) fn LLVMBuildBitCast<'a>(
1554        B: &Builder<'a>,
1555        Val: &'a Value,
1556        DestTy: &'a Type,
1557        Name: *const c_char,
1558    ) -> &'a Value;
1559    pub(crate) fn LLVMBuildPointerCast<'a>(
1560        B: &Builder<'a>,
1561        Val: &'a Value,
1562        DestTy: &'a Type,
1563        Name: *const c_char,
1564    ) -> &'a Value;
1565    pub(crate) fn LLVMBuildIntCast2<'a>(
1566        B: &Builder<'a>,
1567        Val: &'a Value,
1568        DestTy: &'a Type,
1569        IsSigned: Bool,
1570        Name: *const c_char,
1571    ) -> &'a Value;
1572
1573    // Comparisons
1574    pub(crate) fn LLVMBuildICmp<'a>(
1575        B: &Builder<'a>,
1576        Op: c_uint,
1577        LHS: &'a Value,
1578        RHS: &'a Value,
1579        Name: *const c_char,
1580    ) -> &'a Value;
1581    pub(crate) fn LLVMBuildFCmp<'a>(
1582        B: &Builder<'a>,
1583        Op: c_uint,
1584        LHS: &'a Value,
1585        RHS: &'a Value,
1586        Name: *const c_char,
1587    ) -> &'a Value;
1588
1589    // Miscellaneous instructions
1590    pub(crate) fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char)
1591    -> &'a Value;
1592    pub(crate) fn LLVMBuildSelect<'a>(
1593        B: &Builder<'a>,
1594        If: &'a Value,
1595        Then: &'a Value,
1596        Else: &'a Value,
1597        Name: *const c_char,
1598    ) -> &'a Value;
1599    pub(crate) fn LLVMBuildVAArg<'a>(
1600        B: &Builder<'a>,
1601        list: &'a Value,
1602        Ty: &'a Type,
1603        Name: *const c_char,
1604    ) -> &'a Value;
1605    pub(crate) fn LLVMBuildExtractElement<'a>(
1606        B: &Builder<'a>,
1607        VecVal: &'a Value,
1608        Index: &'a Value,
1609        Name: *const c_char,
1610    ) -> &'a Value;
1611    pub(crate) fn LLVMBuildInsertElement<'a>(
1612        B: &Builder<'a>,
1613        VecVal: &'a Value,
1614        EltVal: &'a Value,
1615        Index: &'a Value,
1616        Name: *const c_char,
1617    ) -> &'a Value;
1618    pub(crate) fn LLVMBuildShuffleVector<'a>(
1619        B: &Builder<'a>,
1620        V1: &'a Value,
1621        V2: &'a Value,
1622        Mask: &'a Value,
1623        Name: *const c_char,
1624    ) -> &'a Value;
1625    pub(crate) fn LLVMBuildExtractValue<'a>(
1626        B: &Builder<'a>,
1627        AggVal: &'a Value,
1628        Index: c_uint,
1629        Name: *const c_char,
1630    ) -> &'a Value;
1631    pub(crate) fn LLVMBuildInsertValue<'a>(
1632        B: &Builder<'a>,
1633        AggVal: &'a Value,
1634        EltVal: &'a Value,
1635        Index: c_uint,
1636        Name: *const c_char,
1637    ) -> &'a Value;
1638
1639    // Atomic Operations
1640    pub(crate) fn LLVMBuildAtomicCmpXchg<'a>(
1641        B: &Builder<'a>,
1642        LHS: &'a Value,
1643        CMP: &'a Value,
1644        RHS: &'a Value,
1645        Order: AtomicOrdering,
1646        FailureOrder: AtomicOrdering,
1647        SingleThreaded: Bool,
1648    ) -> &'a Value;
1649
1650    pub(crate) fn LLVMSetWeak(CmpXchgInst: &Value, IsWeak: Bool);
1651
1652    pub(crate) fn LLVMBuildAtomicRMW<'a>(
1653        B: &Builder<'a>,
1654        Op: AtomicRmwBinOp,
1655        LHS: &'a Value,
1656        RHS: &'a Value,
1657        Order: AtomicOrdering,
1658        SingleThreaded: Bool,
1659    ) -> &'a Value;
1660
1661    pub(crate) fn LLVMBuildFence<'a>(
1662        B: &Builder<'a>,
1663        Order: AtomicOrdering,
1664        SingleThreaded: Bool,
1665        Name: *const c_char,
1666    ) -> &'a Value;
1667
1668    /// Writes a module to the specified path. Returns 0 on success.
1669    pub(crate) fn LLVMWriteBitcodeToFile<'ll>(M: Module<'ll>, Path: *const c_char) -> c_int;
1670
1671    pub(crate) fn LLVMGetHostCPUFeatures() -> *mut c_char;
1672
1673    pub(crate) fn LLVMDisposeMessage(message: *mut c_char);
1674
1675    pub(crate) fn LLVMIsMultithreaded() -> Bool;
1676
1677    pub(crate) fn LLVMStructCreateNamed<'ll>(C: Context<'ll>, Name: *const c_char) -> &'ll Type;
1678
1679    pub(crate) fn LLVMStructSetBody<'a>(
1680        StructTy: &'a Type,
1681        ElementTypes: *const &'a Type,
1682        ElementCount: c_uint,
1683        Packed: Bool,
1684    );
1685
1686    pub(crate) fn LLVMCountStructElementTypes(StructTy: &Type) -> c_uint;
1687    pub(crate) fn LLVMGetStructElementTypes<'a>(StructTy: &'a Type, Dest: *mut &'a Type);
1688
1689    pub(crate) safe fn LLVMMetadataAsValue<'ll>(C: Context<'ll>, MD: &'ll Metadata) -> &'ll Value;
1690
1691    pub(crate) safe fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
1692
1693    pub(crate) fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
1694
1695    pub(crate) fn LLVMGetOrInsertComdat<'ll>(M: Module<'ll>, Name: *const c_char) -> &'ll Comdat;
1696    pub(crate) fn LLVMSetComdat(V: &Value, C: &Comdat);
1697
1698    pub(crate) fn LLVMCreateOperandBundle(
1699        Tag: *const c_uchar, // See "PTR_LEN_STR".
1700        TagLen: size_t,
1701        Args: *const &'_ Value,
1702        NumArgs: c_uint,
1703    ) -> *mut OperandBundle<'_>;
1704    pub(crate) fn LLVMDisposeOperandBundle(Bundle: ptr::NonNull<OperandBundle<'_>>);
1705
1706    pub(crate) fn LLVMBuildCallWithOperandBundles<'a>(
1707        B: &Builder<'a>,
1708        Ty: &'a Type,
1709        Fn: &'a Value,
1710        Args: *const &'a Value,
1711        NumArgs: c_uint,
1712        Bundles: *const &OperandBundle<'a>,
1713        NumBundles: c_uint,
1714        Name: *const c_char,
1715    ) -> &'a Value;
1716    pub(crate) fn LLVMBuildInvokeWithOperandBundles<'a>(
1717        B: &Builder<'a>,
1718        Ty: &'a Type,
1719        Fn: &'a Value,
1720        Args: *const &'a Value,
1721        NumArgs: c_uint,
1722        Then: &'a BasicBlock,
1723        Catch: &'a BasicBlock,
1724        Bundles: *const &OperandBundle<'a>,
1725        NumBundles: c_uint,
1726        Name: *const c_char,
1727    ) -> &'a Value;
1728    pub(crate) fn LLVMBuildCallBr<'a>(
1729        B: &Builder<'a>,
1730        Ty: &'a Type,
1731        Fn: &'a Value,
1732        DefaultDest: &'a BasicBlock,
1733        IndirectDests: *const &'a BasicBlock,
1734        NumIndirectDests: c_uint,
1735        Args: *const &'a Value,
1736        NumArgs: c_uint,
1737        Bundles: *const &OperandBundle<'a>,
1738        NumBundles: c_uint,
1739        Name: *const c_char,
1740    ) -> &'a Value;
1741}
1742
1743// FFI bindings for `DIBuilder` functions in the LLVM-C API.
1744// Try to keep these in the same order as in `llvm/include/llvm-c/DebugInfo.h`.
1745//
1746// FIXME(#134001): Audit all `Option` parameters, especially in lists, to check
1747// that they really are nullable on the C/C++ side. LLVM doesn't appear to
1748// actually document which ones are nullable.
1749unsafe extern "C" {
1750    pub(crate) fn LLVMCreateDIBuilder<'ll>(M: Module<'ll>) -> *mut DIBuilder<'ll>;
1751    pub(crate) fn LLVMDisposeDIBuilder<'ll>(Builder: ptr::NonNull<DIBuilder<'ll>>);
1752
1753    pub(crate) fn LLVMDIBuilderFinalize<'ll>(Builder: &DIBuilder<'ll>);
1754
1755    pub(crate) fn LLVMDIBuilderCreateNameSpace<'ll>(
1756        Builder: &DIBuilder<'ll>,
1757        ParentScope: Option<&'ll Metadata>,
1758        Name: *const c_uchar, // See "PTR_LEN_STR".
1759        NameLen: size_t,
1760        ExportSymbols: llvm::Bool,
1761    ) -> &'ll Metadata;
1762
1763    pub(crate) fn LLVMDIBuilderCreateLexicalBlock<'ll>(
1764        Builder: &DIBuilder<'ll>,
1765        Scope: &'ll Metadata,
1766        File: &'ll Metadata,
1767        Line: c_uint,
1768        Column: c_uint,
1769    ) -> &'ll Metadata;
1770
1771    pub(crate) fn LLVMDIBuilderCreateLexicalBlockFile<'ll>(
1772        Builder: &DIBuilder<'ll>,
1773        Scope: &'ll Metadata,
1774        File: &'ll Metadata,
1775        Discriminator: c_uint, // (optional "DWARF path discriminator"; default is 0)
1776    ) -> &'ll Metadata;
1777
1778    pub(crate) fn LLVMDIBuilderCreateDebugLocation<'ll>(
1779        Ctx: Context<'ll>,
1780        Line: c_uint,
1781        Column: c_uint,
1782        Scope: &'ll Metadata,
1783        InlinedAt: Option<&'ll Metadata>,
1784    ) -> &'ll Metadata;
1785
1786    pub(crate) fn LLVMDIBuilderCreateSubroutineType<'ll>(
1787        Builder: &DIBuilder<'ll>,
1788        File: Option<&'ll Metadata>, // (ignored and has no effect)
1789        ParameterTypes: *const Option<&'ll Metadata>,
1790        NumParameterTypes: c_uint,
1791        Flags: DIFlags, // (default is `DIFlags::DIFlagZero`)
1792    ) -> &'ll Metadata;
1793
1794    pub(crate) fn LLVMDIBuilderCreateEnumeratorOfArbitraryPrecision<'ll>(
1795        Builder: &DIBuilder<'ll>,
1796        Name: *const c_uchar, // See "PTR_LEN_STR".
1797        NameLen: size_t,
1798        SizeInBits: u64,
1799        Words: *const u64, // LLVM computes `NumWords = (SizeInBits + 63) / 64`.
1800        IsUnsigned: llvm::Bool,
1801    ) -> &'ll Metadata;
1802
1803    pub(crate) fn LLVMDIBuilderCreateUnionType<'ll>(
1804        Builder: &DIBuilder<'ll>,
1805        Scope: Option<&'ll Metadata>,
1806        Name: *const c_uchar, // See "PTR_LEN_STR".
1807        NameLen: size_t,
1808        File: &'ll Metadata,
1809        LineNumber: c_uint,
1810        SizeInBits: u64,
1811        AlignInBits: u32,
1812        Flags: DIFlags,
1813        Elements: *const Option<&'ll Metadata>,
1814        NumElements: c_uint,
1815        RunTimeLang: c_uint, // (optional Objective-C runtime version; default is 0)
1816        UniqueId: *const c_uchar, // See "PTR_LEN_STR".
1817        UniqueIdLen: size_t,
1818    ) -> &'ll Metadata;
1819
1820    pub(crate) fn LLVMDIBuilderCreateArrayType<'ll>(
1821        Builder: &DIBuilder<'ll>,
1822        Size: u64,
1823        Align: u32,
1824        Ty: &'ll Metadata,
1825        Subscripts: *const &'ll Metadata,
1826        NumSubscripts: c_uint,
1827    ) -> &'ll Metadata;
1828
1829    pub(crate) fn LLVMDIBuilderCreateBasicType<'ll>(
1830        Builder: &DIBuilder<'ll>,
1831        Name: *const c_uchar, // See "PTR_LEN_STR".
1832        NameLen: size_t,
1833        SizeInBits: u64,
1834        Encoding: c_uint, // (`LLVMDWARFTypeEncoding`)
1835        Flags: DIFlags,   // (default is `DIFlags::DIFlagZero`)
1836    ) -> &'ll Metadata;
1837
1838    pub(crate) fn LLVMDIBuilderCreatePointerType<'ll>(
1839        Builder: &DIBuilder<'ll>,
1840        PointeeTy: &'ll Metadata,
1841        SizeInBits: u64,
1842        AlignInBits: u32,
1843        AddressSpace: c_uint, // (optional DWARF address space; default is 0)
1844        Name: *const c_uchar, // See "PTR_LEN_STR".
1845        NameLen: size_t,
1846    ) -> &'ll Metadata;
1847
1848    pub(crate) fn LLVMDIBuilderCreateStructType<'ll>(
1849        Builder: &DIBuilder<'ll>,
1850        Scope: Option<&'ll Metadata>,
1851        Name: *const c_uchar, // See "PTR_LEN_STR".
1852        NameLen: size_t,
1853        File: &'ll Metadata,
1854        LineNumber: c_uint,
1855        SizeInBits: u64,
1856        AlignInBits: u32,
1857        Flags: DIFlags,
1858        DerivedFrom: Option<&'ll Metadata>,
1859        Elements: *const Option<&'ll Metadata>,
1860        NumElements: c_uint,
1861        RunTimeLang: c_uint, // (optional Objective-C runtime version; default is 0)
1862        VTableHolder: Option<&'ll Metadata>,
1863        UniqueId: *const c_uchar, // See "PTR_LEN_STR".
1864        UniqueIdLen: size_t,
1865    ) -> &'ll Metadata;
1866
1867    pub(crate) fn LLVMDIBuilderCreateMemberType<'ll>(
1868        Builder: &DIBuilder<'ll>,
1869        Scope: &'ll Metadata,
1870        Name: *const c_uchar, // See "PTR_LEN_STR".
1871        NameLen: size_t,
1872        File: &'ll Metadata,
1873        LineNo: c_uint,
1874        SizeInBits: u64,
1875        AlignInBits: u32,
1876        OffsetInBits: u64,
1877        Flags: DIFlags,
1878        Ty: &'ll Metadata,
1879    ) -> &'ll Metadata;
1880
1881    pub(crate) fn LLVMDIBuilderCreateStaticMemberType<'ll>(
1882        Builder: &DIBuilder<'ll>,
1883        Scope: &'ll Metadata,
1884        Name: *const c_uchar, // See "PTR_LEN_STR".
1885        NameLen: size_t,
1886        File: &'ll Metadata,
1887        LineNumber: c_uint,
1888        Type: &'ll Metadata,
1889        Flags: DIFlags,
1890        ConstantVal: Option<&'ll Value>,
1891        AlignInBits: u32,
1892    ) -> &'ll Metadata;
1893
1894    /// Creates a "qualified type" in the C/C++ sense, by adding modifiers
1895    /// like `const` or `volatile`.
1896    pub(crate) fn LLVMDIBuilderCreateQualifiedType<'ll>(
1897        Builder: &DIBuilder<'ll>,
1898        Tag: c_uint, // (DWARF tag, e.g. `DW_TAG_const_type`)
1899        Type: &'ll Metadata,
1900    ) -> &'ll Metadata;
1901
1902    pub(crate) fn LLVMDIBuilderCreateTypedef<'ll>(
1903        Builder: &DIBuilder<'ll>,
1904        Type: &'ll Metadata,
1905        Name: *const c_uchar, // See "PTR_LEN_STR".
1906        NameLen: size_t,
1907        File: &'ll Metadata,
1908        LineNo: c_uint,
1909        Scope: Option<&'ll Metadata>,
1910        AlignInBits: u32, // (optional; default is 0)
1911    ) -> &'ll Metadata;
1912
1913    pub(crate) fn LLVMDIBuilderGetOrCreateSubrange<'ll>(
1914        Builder: &DIBuilder<'ll>,
1915        LowerBound: i64,
1916        Count: i64,
1917    ) -> &'ll Metadata;
1918
1919    pub(crate) fn LLVMDIBuilderGetOrCreateArray<'ll>(
1920        Builder: &DIBuilder<'ll>,
1921        Data: *const Option<&'ll Metadata>,
1922        NumElements: size_t,
1923    ) -> &'ll Metadata;
1924
1925    pub(crate) fn LLVMDIBuilderCreateExpression<'ll>(
1926        Builder: &DIBuilder<'ll>,
1927        Addr: *const u64,
1928        Length: size_t,
1929    ) -> &'ll Metadata;
1930
1931    pub(crate) fn LLVMDIBuilderCreateGlobalVariableExpression<'ll>(
1932        Builder: &DIBuilder<'ll>,
1933        Scope: Option<&'ll Metadata>,
1934        Name: *const c_uchar, // See "PTR_LEN_STR".
1935        NameLen: size_t,
1936        Linkage: *const c_uchar, // See "PTR_LEN_STR".
1937        LinkLen: size_t,
1938        File: &'ll Metadata,
1939        LineNo: c_uint,
1940        Ty: &'ll Metadata,
1941        LocalToUnit: llvm::Bool,
1942        Expr: &'ll Metadata,
1943        Decl: Option<&'ll Metadata>,
1944        AlignInBits: u32,
1945    ) -> &'ll Metadata;
1946
1947    pub(crate) fn LLVMDIBuilderInsertDeclareRecordAtEnd<'ll>(
1948        Builder: &DIBuilder<'ll>,
1949        Storage: &'ll Value,
1950        VarInfo: &'ll Metadata,
1951        Expr: &'ll Metadata,
1952        DebugLoc: &'ll Metadata,
1953        Block: &'ll BasicBlock,
1954    ) -> &'ll DbgRecord;
1955
1956    pub(crate) fn LLVMDIBuilderInsertDbgValueRecordAtEnd<'ll>(
1957        Builder: &DIBuilder<'ll>,
1958        Val: &'ll Value,
1959        VarInfo: &'ll Metadata,
1960        Expr: &'ll Metadata,
1961        DebugLoc: &'ll Metadata,
1962        Block: &'ll BasicBlock,
1963    ) -> &'ll DbgRecord;
1964
1965    pub(crate) fn LLVMDIBuilderCreateAutoVariable<'ll>(
1966        Builder: &DIBuilder<'ll>,
1967        Scope: &'ll Metadata,
1968        Name: *const c_uchar, // See "PTR_LEN_STR".
1969        NameLen: size_t,
1970        File: &'ll Metadata,
1971        LineNo: c_uint,
1972        Ty: &'ll Metadata,
1973        AlwaysPreserve: llvm::Bool, // "If true, this descriptor will survive optimizations."
1974        Flags: DIFlags,
1975        AlignInBits: u32,
1976    ) -> &'ll Metadata;
1977
1978    pub(crate) fn LLVMDIBuilderCreateParameterVariable<'ll>(
1979        Builder: &DIBuilder<'ll>,
1980        Scope: &'ll Metadata,
1981        Name: *const c_uchar, // See "PTR_LEN_STR".
1982        NameLen: size_t,
1983        ArgNo: c_uint,
1984        File: &'ll Metadata,
1985        LineNo: c_uint,
1986        Ty: &'ll Metadata,
1987        AlwaysPreserve: llvm::Bool, // "If true, this descriptor will survive optimizations."
1988        Flags: DIFlags,
1989    ) -> &'ll Metadata;
1990}
1991
1992#[link(name = "llvm-wrapper", kind = "static")]
1993unsafe extern "C" {
1994    pub(crate) fn LLVMRustInstallErrorHandlers();
1995    pub(crate) fn LLVMRustDisableSystemDialogsOnCrash();
1996
1997    // Operations on all values
1998    pub(crate) fn LLVMRustIsNonGVFunctionPointerTy(Val: &Value) -> bool;
1999    pub(crate) fn LLVMRustStripPointerCasts<'a>(Val: &'a Value) -> &'a Value;
2000
2001    // Operations on scalar constants
2002    pub(crate) fn LLVMRustConstIntGetZExtValue(ConstantVal: &ConstantInt, Value: &mut u64) -> bool;
2003    pub(crate) fn LLVMRustConstInt128Get(
2004        ConstantVal: &ConstantInt,
2005        SExt: bool,
2006        high: &mut u64,
2007        low: &mut u64,
2008    ) -> bool;
2009
2010    // Operations on global variables, functions, and aliases (globals)
2011    pub(crate) fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
2012
2013    // Operations on global variables
2014    pub(crate) fn LLVMRustGetOrInsertGlobal<'ll>(
2015        M: Module<'ll>,
2016        Name: *const c_uchar, // See "PTR_LEN_STR".
2017        NameLen: size_t,
2018        T: &'ll Type,
2019    ) -> &'ll Value;
2020    pub(crate) fn LLVMRustGetOrInsertGlobalInAddrspace<'ll>(
2021        M: Module<'ll>,
2022        Name: *const c_uchar, // See "PTR_LEN_STR".
2023        NameLen: size_t,
2024        T: &'ll Type,
2025        AddressSpace: c_uint,
2026    ) -> &'ll Value;
2027    pub(crate) fn LLVMRustGetNamedValue<'ll>(
2028        M: Module<'ll>,
2029        Name: *const c_uchar, // See "PTR_LEN_STR".
2030        NameLen: size_t,
2031    ) -> Option<&'ll Value>;
2032
2033    // Operations on attributes
2034    pub(crate) fn LLVMRustCreateAttrNoValue<'ll>(
2035        C: Context<'ll>,
2036        attr: AttributeKind,
2037    ) -> &'ll Attribute;
2038    pub(crate) fn LLVMRustCreateAlignmentAttr<'ll>(C: Context<'ll>, bytes: u64) -> &'ll Attribute;
2039    pub(crate) fn LLVMRustCreateDereferenceableAttr<'ll>(
2040        C: Context<'ll>,
2041        bytes: u64,
2042    ) -> &'ll Attribute;
2043    pub(crate) fn LLVMRustCreateDereferenceableOrNullAttr<'ll>(
2044        C: Context<'ll>,
2045        bytes: u64,
2046    ) -> &'ll Attribute;
2047    pub(crate) fn LLVMRustCreateByValAttr<'ll>(C: Context<'ll>, ty: &'ll Type) -> &'ll Attribute;
2048    pub(crate) fn LLVMRustCreateByRefAttr<'ll>(C: Context<'ll>, ty: &'ll Type) -> &'ll Attribute;
2049    pub(crate) fn LLVMRustCreateStructRetAttr<'ll>(
2050        C: Context<'ll>,
2051        ty: &'ll Type,
2052    ) -> &'ll Attribute;
2053    pub(crate) fn LLVMRustCreateElementTypeAttr<'ll>(
2054        C: Context<'ll>,
2055        ty: &'ll Type,
2056    ) -> &'ll Attribute;
2057    pub(crate) fn LLVMRustCreateUWTableAttr<'ll>(C: Context<'ll>, async_: bool) -> &'ll Attribute;
2058    pub(crate) fn LLVMRustCreateAllocSizeAttr<'ll>(
2059        C: Context<'ll>,
2060        size_arg: u32,
2061    ) -> &'ll Attribute;
2062    pub(crate) fn LLVMRustCreateAllocKindAttr<'ll>(
2063        C: Context<'ll>,
2064        size_arg: u64,
2065    ) -> &'ll Attribute;
2066    pub(crate) fn LLVMRustCreateMemoryEffectsAttr<'ll>(
2067        C: Context<'ll>,
2068        effects: MemoryEffects,
2069    ) -> &'ll Attribute;
2070    /// ## Safety
2071    /// - Each of `LowerWords` and `UpperWords` must point to an array that is
2072    ///   long enough to fully define an integer of size `NumBits`, i.e. each
2073    ///   pointer must point to `NumBits.div_ceil(64)` elements or more.
2074    /// - The implementation will make its own copy of the pointed-to `u64`
2075    ///   values, so the pointers only need to outlive this function call.
2076    pub(crate) fn LLVMRustCreateRangeAttribute<'ll>(
2077        C: Context<'ll>,
2078        NumBits: c_uint,
2079        LowerWords: *const u64,
2080        UpperWords: *const u64,
2081    ) -> &'ll Attribute;
2082
2083    // Operations on functions
2084    pub(crate) fn LLVMRustAddFunctionAttributes<'a>(
2085        Fn: &'a Value,
2086        index: c_uint,
2087        Attrs: *const &'a Attribute,
2088        AttrsLen: size_t,
2089    );
2090
2091    // Operations on call sites
2092    pub(crate) fn LLVMRustAddCallSiteAttributes<'a>(
2093        Instr: &'a Value,
2094        index: c_uint,
2095        Attrs: *const &'a Attribute,
2096        AttrsLen: size_t,
2097    );
2098
2099    pub(crate) fn LLVMRustSetFastMath(Instr: &Value);
2100    pub(crate) fn LLVMRustSetAlgebraicMath(Instr: &Value);
2101    pub(crate) fn LLVMRustSetAllowReassoc(Instr: &Value);
2102    pub(crate) fn LLVMRustSetNoSignedZeros(Instr: &Value);
2103
2104    // Miscellaneous instructions
2105    pub(crate) fn LLVMRustBuildMemCpy<'a>(
2106        B: &Builder<'a>,
2107        Dst: &'a Value,
2108        DstAlign: c_uint,
2109        Src: &'a Value,
2110        SrcAlign: c_uint,
2111        Size: &'a Value,
2112        IsVolatile: bool,
2113    ) -> &'a Value;
2114    pub(crate) fn LLVMRustBuildMemMove<'a>(
2115        B: &Builder<'a>,
2116        Dst: &'a Value,
2117        DstAlign: c_uint,
2118        Src: &'a Value,
2119        SrcAlign: c_uint,
2120        Size: &'a Value,
2121        IsVolatile: bool,
2122    ) -> &'a Value;
2123    pub(crate) fn LLVMRustBuildMemSet<'a>(
2124        B: &Builder<'a>,
2125        Dst: &'a Value,
2126        DstAlign: c_uint,
2127        Val: &'a Value,
2128        Size: &'a Value,
2129        IsVolatile: bool,
2130    ) -> &'a Value;
2131
2132    pub(crate) fn LLVMRustBuildVScale<'a>(B: &Builder<'a>, Ty: &'a Type) -> &'a Value;
2133
2134    pub(crate) fn LLVMRustTimeTraceProfilerInitialize();
2135
2136    pub(crate) fn LLVMRustTimeTraceProfilerFinishThread();
2137
2138    pub(crate) fn LLVMRustTimeTraceProfilerFinish(FileName: *const c_char);
2139
2140    /// Returns a string describing the last error caused by an LLVMRust* call.
2141    pub(crate) fn LLVMRustGetLastError() -> *const c_char;
2142
2143    /// Prints the timing information collected by `-Ztime-llvm-passes`.
2144    pub(crate) fn LLVMRustPrintPassTimings(OutStr: &RustString);
2145
2146    /// Prints the statistics collected by `-Zprint-codegen-stats`.
2147    pub(crate) fn LLVMRustPrintStatistics(OutStr: &RustString);
2148
2149    /// Save the statistics collected by `-Zprint-codegen-stats-json`
2150    pub(crate) fn LLVMRustPrintStatisticsJSON(OutStr: &RustString);
2151
2152    pub(crate) fn LLVMRustInlineAsmVerify(
2153        Ty: &Type,
2154        Constraints: *const c_uchar, // See "PTR_LEN_STR".
2155        ConstraintsLen: size_t,
2156    ) -> bool;
2157
2158    /// Append inline assembly to a module. See `Module::appendModuleInlineAsm`.
2159    pub(crate) fn LLVMRustAppendModuleInlineAsm<'ll>(
2160        M: Module<'ll>,
2161        Asm: *const c_uchar, // See "PTR_LEN_STR".
2162        AsmLen: size_t,
2163        TargetFeatures: *const c_uchar, // See "PTR_LEN_STR".
2164        TargetFeaturesLen: size_t,
2165        TargetCpu: *const c_uchar, // See "PTR_LEN_STR".
2166        TargetCpuLen: size_t,
2167    );
2168
2169    /// A list of pointer-length strings is passed as two pointer-length slices,
2170    /// one slice containing pointers and one slice containing their corresponding
2171    /// lengths. The implementation will check that both slices have the same length.
2172    pub(crate) fn LLVMRustCoverageWriteFilenamesToBuffer(
2173        Filenames: *const *const c_uchar, // See "PTR_LEN_STR".
2174        FilenamesLen: size_t,
2175        Lengths: *const size_t,
2176        LengthsLen: size_t,
2177        BufferOut: &RustString,
2178    );
2179
2180    pub(crate) fn LLVMRustCoverageWriteFunctionMappingsToBuffer(
2181        VirtualFileMappingIDs: *const c_uint,
2182        NumVirtualFileMappingIDs: size_t,
2183        Expressions: *const crate::coverageinfo::ffi::CounterExpression,
2184        NumExpressions: size_t,
2185        CodeRegions: *const crate::coverageinfo::ffi::CodeRegion,
2186        NumCodeRegions: size_t,
2187        ExpansionRegions: *const crate::coverageinfo::ffi::ExpansionRegion,
2188        NumExpansionRegions: size_t,
2189        BranchRegions: *const crate::coverageinfo::ffi::BranchRegion,
2190        NumBranchRegions: size_t,
2191        BufferOut: &RustString,
2192    );
2193
2194    pub(crate) fn LLVMRustCoverageCreatePGOFuncNameVar(
2195        F: &Value,
2196        FuncName: *const c_uchar, // See "PTR_LEN_STR".
2197        FuncNameLen: size_t,
2198    ) -> &Value;
2199    pub(crate) fn LLVMRustCoverageHashBytes(
2200        Bytes: *const c_uchar, // See "PTR_LEN_STR".
2201        NumBytes: size_t,
2202    ) -> u64;
2203
2204    pub(crate) safe fn LLVMRustCoverageWriteCovmapSectionNameToString<'ll>(
2205        M: Module<'ll>,
2206        OutStr: &RustString,
2207    );
2208    pub(crate) safe fn LLVMRustCoverageWriteCovfunSectionNameToString<'ll>(
2209        M: Module<'ll>,
2210        OutStr: &RustString,
2211    );
2212    pub(crate) safe fn LLVMRustCoverageWriteCovmapVarNameToString(OutStr: &RustString);
2213
2214    pub(crate) safe fn LLVMRustCoverageMappingVersion() -> u32;
2215    pub(crate) fn LLVMRustDebugMetadataVersion() -> u32;
2216
2217    /// Returns the LLVM major version that the compiler was built with.
2218    ///
2219    /// Note that this is hard-coded as `LLVM_VERSION_MAJOR` when `RustWrapper.cpp` is built. This
2220    /// could be different than what the runtime LLVM library reports in [`LLVMGetVersion`], so we
2221    /// assert their equality in `configure_llvm`.
2222    pub(crate) safe fn LLVMRustVersionMajor() -> u32;
2223
2224    /// Add LLVM module flags.
2225    ///
2226    /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
2227    /// "compatible" means depends on the merge behaviors involved.
2228    pub(crate) fn LLVMRustAddModuleFlagU32<'ll>(
2229        M: Module<'ll>,
2230        MergeBehavior: ModuleFlagMergeBehavior,
2231        Name: *const c_uchar, // See "PTR_LEN_STR".
2232        NameLen: size_t,
2233        Value: u32,
2234    );
2235
2236    pub(crate) fn LLVMRustAddModuleFlagString<'ll>(
2237        M: Module<'ll>,
2238        MergeBehavior: ModuleFlagMergeBehavior,
2239        Name: *const c_uchar, // See "PTR_LEN_STR".
2240        NameLen: size_t,
2241        Value: *const c_uchar, // See "PTR_LEN_STR".
2242        ValueLen: size_t,
2243    );
2244
2245    /// We can't use LLVM-C's `LLVMDIBuilderCreateCompileUnit` because it hardcodes
2246    /// `DICompileUnit::DebugNameTableKind::Default`, but we want to be able to
2247    /// pass other values.
2248    pub(crate) fn LLVMRustDIBuilderCreateCompileUnit<'a>(
2249        Builder: &DIBuilder<'a>,
2250        Lang: c_uint,
2251        File: &'a DIFile,
2252        Producer: *const c_uchar, // See "PTR_LEN_STR".
2253        ProducerLen: size_t,
2254        isOptimized: bool,
2255        Flags: *const c_char,
2256        RuntimeVer: c_uint,
2257        SplitName: *const c_uchar, // See "PTR_LEN_STR".
2258        SplitNameLen: size_t,
2259        kind: DebugEmissionKind,
2260        DWOId: u64,
2261        SplitDebugInlining: bool,
2262        DebugNameTableKind: DebugNameTableKind,
2263    ) -> &'a DIDescriptor;
2264
2265    /// We can't use LLVM-C's `LLVMDIBuilderCreateFileWithChecksum` because it
2266    /// _requires_ a checksum, but we sometimes don't provide one.
2267    pub(crate) fn LLVMRustDIBuilderCreateFile<'a>(
2268        Builder: &DIBuilder<'a>,
2269        Filename: *const c_uchar, // See "PTR_LEN_STR".
2270        FilenameLen: size_t,
2271        Directory: *const c_uchar, // See "PTR_LEN_STR".
2272        DirectoryLen: size_t,
2273        CSKind: ChecksumKind,
2274        Checksum: *const c_uchar, // See "PTR_LEN_STR".
2275        ChecksumLen: size_t,
2276        Source: *const c_uchar, // See "PTR_LEN_STR".
2277        SourceLen: size_t,
2278    ) -> &'a DIFile;
2279
2280    /// We can't use LLVM-C's `LLVMDIBuilderCreateFunction` because it only
2281    /// supports a subset of `DISubprogram::DISPFlags`.
2282    pub(crate) fn LLVMRustDIBuilderCreateFunction<'a>(
2283        Builder: &DIBuilder<'a>,
2284        Scope: &'a DIDescriptor,
2285        Name: *const c_uchar, // See "PTR_LEN_STR".
2286        NameLen: size_t,
2287        LinkageName: *const c_uchar, // See "PTR_LEN_STR".
2288        LinkageNameLen: size_t,
2289        File: &'a DIFile,
2290        LineNo: c_uint,
2291        Ty: &'a DIType,
2292        ScopeLine: c_uint,
2293        Flags: DIFlags,
2294        SPFlags: DISPFlags,
2295        MaybeFn: Option<&'a Value>,
2296        TParam: &'a DIArray,
2297        Decl: Option<&'a DIDescriptor>,
2298    ) -> &'a DISubprogram;
2299
2300    /// As of LLVM 22 there is no corresponding LLVM-C function.
2301    pub(crate) fn LLVMRustDIBuilderCreateMethod<'a>(
2302        Builder: &DIBuilder<'a>,
2303        Scope: &'a DIDescriptor,
2304        Name: *const c_uchar, // See "PTR_LEN_STR".
2305        NameLen: size_t,
2306        LinkageName: *const c_uchar, // See "PTR_LEN_STR".
2307        LinkageNameLen: size_t,
2308        File: &'a DIFile,
2309        LineNo: c_uint,
2310        Ty: &'a DIType,
2311        Flags: DIFlags,
2312        SPFlags: DISPFlags,
2313        TParam: &'a DIArray,
2314    ) -> &'a DISubprogram;
2315
2316    /// As of LLVM 22 there is no corresponding LLVM-C function.
2317    pub(crate) fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2318        Builder: &DIBuilder<'a>,
2319        Scope: &'a DIScope,
2320        Name: *const c_uchar, // See "PTR_LEN_STR".
2321        NameLen: size_t,
2322        File: &'a DIFile,
2323        LineNumber: c_uint,
2324        SizeInBits: u64,
2325        AlignInBits: u32,
2326        OffsetInBits: u64,
2327        Discriminant: Option<&'a Value>,
2328        Flags: DIFlags,
2329        Ty: &'a DIType,
2330    ) -> &'a DIType;
2331
2332    /// As of LLVM 22 there is no corresponding LLVM-C function.
2333    pub(crate) fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2334        Builder: &DIBuilder<'a>,
2335        Scope: &'a DIScope,
2336        Name: *const c_uchar, // See "PTR_LEN_STR".
2337        NameLen: size_t,
2338        File: &'a DIFile,
2339        LineNumber: c_uint,
2340        SizeInBits: u64,
2341        AlignInBits: u32,
2342        Elements: &'a DIArray,
2343        ClassType: &'a DIType,
2344        IsScoped: bool,
2345    ) -> &'a DIType;
2346
2347    /// As of LLVM 22 there is no corresponding LLVM-C function.
2348    pub(crate) fn LLVMRustDIBuilderCreateVariantPart<'a>(
2349        Builder: &DIBuilder<'a>,
2350        Scope: &'a DIScope,
2351        Name: *const c_uchar, // See "PTR_LEN_STR".
2352        NameLen: size_t,
2353        File: &'a DIFile,
2354        LineNo: c_uint,
2355        SizeInBits: u64,
2356        AlignInBits: u32,
2357        Flags: DIFlags,
2358        Discriminator: Option<&'a DIDerivedType>,
2359        Elements: &'a DIArray,
2360        UniqueId: *const c_uchar, // See "PTR_LEN_STR".
2361        UniqueIdLen: size_t,
2362    ) -> &'a DIDerivedType;
2363
2364    /// As of LLVM 22 there is no corresponding LLVM-C function.
2365    pub(crate) fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2366        Builder: &DIBuilder<'a>,
2367        Scope: Option<&'a DIScope>,
2368        Name: *const c_uchar, // See "PTR_LEN_STR".
2369        NameLen: size_t,
2370        Ty: &'a DIType,
2371    ) -> &'a DITemplateTypeParameter;
2372
2373    /// We can't use LLVM-C's `LLVMReplaceArrays` because it doesn't take a
2374    /// `Params` argument.
2375    pub(crate) fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2376        Builder: &DIBuilder<'a>,
2377        CompositeType: &'a DIType,
2378        Elements: Option<&'a DIArray>,
2379        Params: Option<&'a DIArray>,
2380    );
2381
2382    /// We can't use LLVM-C's `LLVMDIBuilderGetOrCreateSubrange` because it doesn't
2383    /// call the overload that takes a `Metadata` upper bound.
2384    pub(crate) fn LLVMRustDIGetOrCreateSubrange<'a>(
2385        Builder: &DIBuilder<'a>,
2386        CountNode: Option<&'a Metadata>,
2387        LB: &'a Metadata,
2388        UB: &'a Metadata,
2389        Stride: Option<&'a Metadata>,
2390    ) -> &'a Metadata;
2391
2392    /// We can't use LLVM-C's `LLVMDIBuilderCreateVectorType` because it doesn't
2393    /// take a `BitStride` argument.
2394    pub(crate) fn LLVMRustDICreateVectorType<'a>(
2395        Builder: &DIBuilder<'a>,
2396        Size: u64,
2397        AlignInBits: u32,
2398        Type: &'a DIType,
2399        Subscripts: &'a DIArray,
2400        BitStride: Option<&'a Metadata>,
2401    ) -> &'a Metadata;
2402
2403    /// As of LLVM 22 there is no corresponding LLVM-C function.
2404    pub(crate) fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
2405        Location: &'a DILocation,
2406        BD: c_uint,
2407    ) -> Option<&'a DILocation>;
2408
2409    pub(crate) fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2410    pub(crate) fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2411
2412    pub(crate) fn LLVMRustTargetHasMnemonic(T: &TargetMachine, s: *const c_char) -> bool;
2413
2414    pub(crate) fn LLVMRustPrintTargetCPUs(TM: &TargetMachine, OutStr: &RustString);
2415    pub(crate) fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2416    pub(crate) fn LLVMRustGetTargetFeature(
2417        T: &TargetMachine,
2418        Index: size_t,
2419        Feature: &mut *const c_char,
2420        Desc: &mut *const c_char,
2421    );
2422
2423    pub(crate) fn LLVMRustGetHostCPUName(LenOut: &mut size_t) -> *const u8;
2424
2425    // This function makes copies of pointed to data, so the data's lifetime may end after this
2426    // function returns.
2427    pub(crate) fn LLVMRustCreateTargetMachine(
2428        Triple: *const c_char,
2429        CPU: *const c_char,
2430        Features: *const c_char,
2431        Abi: *const c_char,
2432        Model: CodeModel,
2433        Reloc: RelocModel,
2434        Level: CodeGenOptLevel,
2435        FloatABIType: FloatAbi,
2436        FunctionSections: bool,
2437        DataSections: bool,
2438        UniqueSectionNames: bool,
2439        TrapUnreachable: bool,
2440        Singlethread: bool,
2441        VerboseAsm: bool,
2442        EmitStackSizeSection: bool,
2443        RelaxELFRelocations: bool,
2444        UseInitArray: bool,
2445        SplitDwarfFile: *const c_char,
2446        OutputObjFile: *const c_char,
2447        DebugInfoCompression: CompressionKind,
2448        UseEmulatedTls: bool,
2449        UseWasmEH: bool,
2450        LargeDataThreshold: u64,
2451    ) -> *mut TargetMachine;
2452
2453    pub(crate) fn LLVMRustCreateMCSubtargetInfo(
2454        TripleStr: *const c_char,
2455        CPU: *const c_char,
2456        Features: *const c_char,
2457    ) -> *mut MCSubtargetInfo;
2458
2459    pub(crate) fn LLVMRustMCSubtargetInfoCheckFeatures(
2460        MCInfo: &MCSubtargetInfo,
2461        Features: *const c_uchar, // See "PTR_LEN_STR".
2462        FeaturesLen: usize,
2463    ) -> bool;
2464
2465    pub(crate) fn LLVMRustDisposeMCSubtargetInfo(MCInfo: ptr::NonNull<MCSubtargetInfo>);
2466
2467    pub(crate) fn LLVMRustWriteOutputFile<'ll>(
2468        T: &'ll TargetMachine,
2469        M: Module<'ll>,
2470        Output: *const c_char,
2471        DwoOutput: *const c_char,
2472        FileType: FileType,
2473        VerifyIR: bool,
2474        DisableSimplifyLibCalls: bool,
2475    ) -> LLVMRustResult;
2476    pub(crate) fn LLVMRustOptimize<'ll>(
2477        M: Module<'ll>,
2478        TM: &'ll TargetMachine,
2479        OptLevel: PassBuilderOptLevel,
2480        OptStage: OptStage,
2481        IsLinkerPluginLTO: bool,
2482        NoPrepopulatePasses: bool,
2483        VerifyIR: bool,
2484        LintIR: bool,
2485        ThinLTOBuffer: Option<&mut Option<crate::back::lto::Buffer>>,
2486        ThinLTOSummaryBuffer: Option<&mut Option<crate::back::lto::Buffer>>,
2487        MergeFunctions: bool,
2488        UnrollLoops: bool,
2489        SLPVectorize: bool,
2490        LoopVectorize: bool,
2491        DisableSimplifyLibCalls: bool,
2492        EmitLifetimeMarkers: bool,
2493        RunEnzyme: *const c_void,
2494        PrintBeforeEnzyme: bool,
2495        PrintAfterEnzyme: bool,
2496        PrintPasses: bool,
2497        SanitizerOptions: Option<&SanitizerOptions>,
2498        PGOGenPath: *const c_char,
2499        PGOUsePath: *const c_char,
2500        InstrumentCoverage: bool,
2501        InstrProfileOutput: *const c_char,
2502        PGOSampleUsePath: *const c_char,
2503        DebugInfoForProfiling: bool,
2504        llvm_selfprofiler: *mut c_void,
2505        begin_callback: SelfProfileBeforePassCallback,
2506        end_callback: SelfProfileAfterPassCallback,
2507        PostEnzymePasses: *const c_uchar, // See "PTR_LEN_STR".
2508        PostEnzymePassesLen: size_t,
2509        ExtraPasses: *const c_uchar, // See "PTR_LEN_STR".
2510        ExtraPassesLen: size_t,
2511        LLVMPlugins: *const c_uchar, // See "PTR_LEN_STR".
2512        LLVMPluginsLen: size_t,
2513    ) -> LLVMRustResult;
2514    pub(crate) fn LLVMRustPrintModule<'ll>(
2515        M: Module<'ll>,
2516        Output: *const c_char,
2517        Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2518    ) -> LLVMRustResult;
2519    pub(crate) fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2520    pub(crate) fn LLVMRustPrintPasses();
2521    pub(crate) fn LLVMRustSetNormalizedTarget<'ll>(M: Module<'ll>, triple: *const c_char);
2522    pub(crate) fn LLVMRustRunRestrictionPass<'ll>(
2523        M: Module<'ll>,
2524        syms: *const *const c_char,
2525        len: size_t,
2526    );
2527
2528    pub(crate) fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2529
2530    pub(crate) fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2531        DI: &'a DiagnosticInfo,
2532        pass_name_out: &RustString,
2533        function_out: &mut Option<&'a Value>,
2534        loc_line_out: &mut c_uint,
2535        loc_column_out: &mut c_uint,
2536        loc_filename_out: &RustString,
2537        message_out: &RustString,
2538    );
2539
2540    pub(crate) fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2541        DI: &'a DiagnosticInfo,
2542        cookie_out: &mut u64,
2543        message_out: &mut Option<&'a Twine>,
2544    );
2545
2546    pub(crate) fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2547    pub(crate) fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2548    pub(crate) fn LLVMGetDiagInfoSeverity(DI: &DiagnosticInfo) -> DiagnosticSeverity;
2549
2550    pub(crate) fn LLVMRustGetSMDiagnostic<'a>(
2551        DI: &'a DiagnosticInfo,
2552        cookie_out: &mut u64,
2553    ) -> &'a SMDiagnostic;
2554
2555    pub(crate) fn LLVMRustUnpackSMDiagnostic(
2556        d: &SMDiagnostic,
2557        message_out: &RustString,
2558        buffer_out: &RustString,
2559        loc_out: &mut c_uint,
2560        ranges_out: *mut c_uint,
2561        num_ranges: &mut usize,
2562    ) -> bool;
2563
2564    pub(crate) fn LLVMRustSetDataLayoutFromTargetMachine<'ll>(M: Module<'ll>, TM: &TargetMachine);
2565
2566    pub(crate) fn LLVMRustPositionBuilderPastAllocas<'a>(B: &Builder<'a>, Fn: &'a Value);
2567    pub(crate) fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2568
2569    pub(crate) fn LLVMRustSetModulePICLevel<'ll>(M: Module<'ll>);
2570    pub(crate) fn LLVMRustSetModulePIELevel<'ll>(M: Module<'ll>);
2571    pub(crate) fn LLVMRustSetModuleCodeModel<'ll>(M: Module<'ll>, Model: CodeModel);
2572    pub(crate) fn LLVMRustSetModuleLargeDataThreshold<'ll>(M: Module<'ll>, Threshold: u64);
2573    pub(crate) fn LLVMRustBufferPtr(p: &Buffer) -> *const u8;
2574    pub(crate) fn LLVMRustBufferLen(p: &Buffer) -> usize;
2575    pub(crate) fn LLVMRustBufferFree(p: &'static mut Buffer);
2576    pub(crate) fn LLVMRustModuleCost<'ll>(M: Module<'ll>) -> u64;
2577    pub(crate) fn LLVMRustModuleInstructionStats<'ll>(M: Module<'ll>) -> u64;
2578
2579    pub(crate) fn LLVMRustModuleSerialize<'ll>(
2580        M: Module<'ll>,
2581        is_thin: bool,
2582    ) -> &'static mut Buffer;
2583    pub(crate) fn LLVMRustCreateThinLTOData(
2584        Modules: *const ThinLTOModule,
2585        NumModules: size_t,
2586        PreservedSymbols: *const *const c_char,
2587        PreservedSymbolsLen: size_t,
2588    ) -> Option<&'static mut ThinLTOData>;
2589    pub(crate) fn LLVMRustPrepareThinLTORename<'ll>(
2590        Data: &ThinLTOData,
2591        Module: Module<'ll>,
2592        Target: &TargetMachine,
2593    );
2594    pub(crate) fn LLVMRustPrepareThinLTOResolveWeak<'ll>(
2595        Data: &ThinLTOData,
2596        Module: Module<'ll>,
2597    ) -> bool;
2598    pub(crate) fn LLVMRustPrepareThinLTOInternalize<'ll>(
2599        Data: &ThinLTOData,
2600        Module: Module<'ll>,
2601    ) -> bool;
2602    pub(crate) fn LLVMRustPrepareThinLTOImport<'ll>(
2603        Data: &ThinLTOData,
2604        Module: Module<'ll>,
2605        Target: &TargetMachine,
2606    ) -> bool;
2607    pub(crate) fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2608    pub(crate) fn LLVMRustParseBitcodeForLTO<'ll>(
2609        Context: Context<'ll>,
2610        Data: *const u8,
2611        len: usize,
2612        Identifier: *const c_char,
2613    ) -> Option<Module<'ll>>;
2614
2615    pub(crate) fn LLVMRustLinkerNew<'ll>(M: Module<'ll>) -> &'ll mut Linker<'ll>;
2616    pub(crate) fn LLVMRustLinkerAdd(
2617        linker: &Linker<'_>,
2618        bytecode: *const c_uchar, // See "PTR_LEN_STR".
2619        bytecode_len: usize,
2620    ) -> bool;
2621    pub(crate) fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2622    pub(crate) fn LLVMRustComputeLTOCacheKey(
2623        key_out: &RustString,
2624        mod_id: *const c_char,
2625        data: &ThinLTOData,
2626    );
2627
2628    /// Removes the currently-installed `DiagnosticHandler`, and returns an owning pointer to it.
2629    pub(crate) fn LLVMRustContextTakeDiagnosticHandler<'ll>(
2630        Context: Context<'ll>,
2631    ) -> Option<ptr::NonNull<DiagnosticHandler>>;
2632
2633    /// Installs a diagnostic handler that was previously removed by
2634    /// [`LLVMRustContextTakeDiagnosticHandler`].
2635    pub(crate) fn LLVMRustContextSetDiagnosticHandler<'ll>(
2636        context: Context<'ll>,
2637        diagnostic_handler: Option<ptr::NonNull<DiagnosticHandler>>,
2638    );
2639
2640    /// Installs a custom diagnostic handler.
2641    pub(crate) fn LLVMRustContextConfigureDiagnosticHandler<'ll>(
2642        context: Context<'ll>,
2643        diagnostic_handler_callback: DiagnosticHandlerCallback,
2644        diagnostic_handler_callback_data: *mut c_void,
2645        remark_all_passes: bool,
2646        remark_passes: *const *const c_char,
2647        remark_passes_len: usize,
2648        remark_file: *const c_char,
2649        pgo_available: bool,
2650    );
2651
2652    pub(crate) fn LLVMRustGetMangledName(V: &Value, out: &RustString);
2653
2654    pub(crate) fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;
2655
2656    pub(crate) safe fn LLVMRustLLVMHasZlibCompression() -> bool;
2657    pub(crate) safe fn LLVMRustLLVMHasZstdCompression() -> bool;
2658
2659    pub(crate) fn LLVMRustGetSymbols(
2660        buf_ptr: *const u8,
2661        buf_len: usize,
2662        state: *mut c_void,
2663        callback: GetSymbolsCallback,
2664        error_callback: GetSymbolsErrorCallback,
2665    ) -> *mut c_void;
2666
2667    pub(crate) fn LLVMRustIs64BitSymbolicFile(buf_ptr: *const u8, buf_len: usize) -> bool;
2668
2669    pub(crate) fn LLVMRustIsECObject(buf_ptr: *const u8, buf_len: usize) -> bool;
2670
2671    pub(crate) fn LLVMRustIsAnyArm64Coff(buf_ptr: *const u8, buf_len: usize) -> bool;
2672
2673    pub(crate) fn LLVMRustSetNoSanitizeAddress(Global: &Value);
2674    pub(crate) fn LLVMRustSetNoSanitizeHWAddress(Global: &Value);
2675
2676    pub(crate) fn LLVMRustConstPtrAuth(
2677        ptr: *const Value,
2678        key: u32,
2679        disc: u64,
2680        addr_diversity: *const Value,
2681        deactivation_symbol: *const Value,
2682    ) -> *const Value;
2683}