diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2025-02-24 09:42:57 +0200 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2025-02-24 09:42:57 +0200 |
| commit | 36e41b57e9aaef20d1056d17ae673be419cb6ef9 (patch) | |
| tree | 4c68892b6020552136f968d4b287f4af98dc6b86 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 386d7a5d0a9a8e4273dcdf34c05bca69d7ca600d (diff) | |
| parent | e0be1a02626abef2878cb7f4aaef7ae409477112 (diff) | |
| download | rust-36e41b57e9aaef20d1056d17ae673be419cb6ef9.tar.gz rust-36e41b57e9aaef20d1056d17ae673be419cb6ef9.zip | |
Merge from rust-lang/rust
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index b8cef6a7e25..aea2a8dd097 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1767,6 +1767,24 @@ extern "C" LLVMValueRef LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS), unwrap(RHS))); } +#if LLVM_VERSION_LT(19, 0) +enum { + LLVMGEPFlagInBounds = (1 << 0), + LLVMGEPFlagNUSW = (1 << 1), + LLVMGEPFlagNUW = (1 << 2), +}; +extern "C" LLVMValueRef +LLVMBuildGEPWithNoWrapFlags(LLVMBuilderRef B, LLVMTypeRef Ty, + LLVMValueRef Pointer, LLVMValueRef *Indices, + unsigned NumIndices, const char *Name, + unsigned NoWrapFlags) { + if (NoWrapFlags & LLVMGEPFlagInBounds) + return LLVMBuildInBoundsGEP2(B, Ty, Pointer, Indices, NumIndices, Name); + else + return LLVMBuildGEP2(B, Ty, Pointer, Indices, NumIndices, Name); +} +#endif + // Transfers ownership of DiagnosticHandler unique_ptr to the caller. extern "C" DiagnosticHandler * LLVMRustContextGetDiagnosticHandler(LLVMContextRef C) { |
