diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-12-12 19:00:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-12 19:00:44 +0100 |
| commit | 6d79df6867589ca485acdaad51a50f71400e934f (patch) | |
| tree | 67a218d69309b4019dd21e927ea451fadf6e2def /compiler/rustc_codegen_llvm/src | |
| parent | f620e4616eb26cabed16417d10965045f2c41246 (diff) | |
| parent | f7c6a2cf11eb075ea56b54c48756ee55d0b2aeb1 (diff) | |
| download | rust-6d79df6867589ca485acdaad51a50f71400e934f.tar.gz rust-6d79df6867589ca485acdaad51a50f71400e934f.zip | |
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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 8b4523bd252..d62632d1431 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -17,7 +17,9 @@ use super::debuginfo::{ 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 False: Bool = 0 as Bool; |
