Skip to main content

rustc_codegen_llvm/llvm/
ffi.rs

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