Rollup merge of #134204 - Zalathar:llvm-bool, r=SparrowLii

Fix our `llvm::Bool` typedef to be signed, to match `LLVMBool`

In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`, but our Rust-side typedef was using `c_uint` instead.

Signed and unsigned integers have the same ABI on most platforms, but that isn't universally true, so we should prefer to be consistent with LLVM.

https://github.com/rust-lang/llvm-project/blob/1268e87/llvm/include/llvm-c/Types.h#L28
This commit is contained in:
Matthias Krüger 2024-12-12 19:00:44 +01:00 committed by GitHub
commit 6d79df6867
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,9 @@ use super::debuginfo::{
DebugEmissionKind, DebugNameTableKind, DebugEmissionKind, DebugNameTableKind,
}; };
pub type Bool = c_uint; /// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
/// which has a different ABI from Rust or C++ `bool`.
pub type Bool = c_int;
pub const True: Bool = 1 as Bool; pub const True: Bool = 1 as Bool;
pub const False: Bool = 0 as Bool; pub const False: Bool = 0 as Bool;