Rollup merge of #140534 - erickt:llvm-21, r=cuviper

PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef…

…7e8877fc1908

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
This commit is contained in:
Matthias Krüger 2025-05-03 08:45:02 +02:00 committed by GitHub
commit 9ff7455551
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}