diff options
| author | Erick Tryzelaar <etryzelaar@google.com> | 2025-05-01 00:37:37 +0000 |
|---|---|---|
| committer | Erick Tryzelaar <etryzelaar@google.com> | 2025-05-01 17:59:00 +0000 |
| commit | 951412e2f3cf2b27f9a22076b5cb77fb8ff5f259 (patch) | |
| tree | 8f307eb078815afd90b03ee369a6a6403246b81c /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 7188f453111502962326022740e2657fce0a6939 (diff) | |
| download | rust-951412e2f3cf2b27f9a22076b5cb77fb8ff5f259.tar.gz rust-951412e2f3cf2b27f9a22076b5cb77fb8ff5f259.zip | |
PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef7e8877fc1908
In LLVM 21 PR https://github.com/llvm/llvm-project/pull/130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. @rustbot label llvm-main
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index ebe8eb57f2c..d4a05fbbbc5 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -512,8 +512,13 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( #endif } +#if LLVM_VERSION_GE(21, 0) + TargetMachine *TM = TheTarget->createTargetMachine(Trip, CPU, Feature, + Options, RM, CM, OptLevel); +#else TargetMachine *TM = TheTarget->createTargetMachine( Trip.getTriple(), CPU, Feature, Options, RM, CM, OptLevel); +#endif return wrap(TM); } |
