Rollup merge of #147446 - durin42:llvm-22-lookupTarget-deprecation, r=Zalathar
PassWrapper: use non-deprecated lookupTarget method This avoids an extra trip through a triple string by directly passing the Triple, and has been available since LLVM 21. The string overload was deprecated today and throws an error on our CI for HEAD due to -Werror paranoia, so we may as well clean this up now and also skip the conversion on LLVM 21 since we can. `@rustbot` label llvm-main
This commit is contained in:
commit
c33f0b373b
1 changed files with 4 additions and 0 deletions
|
|
@ -283,7 +283,11 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
|||
std::string Error;
|
||||
auto Trip = Triple(Triple::normalize(TripleStr));
|
||||
const llvm::Target *TheTarget =
|
||||
#if LLVM_VERSION_GE(21, 0)
|
||||
TargetRegistry::lookupTarget(Trip, Error);
|
||||
#else
|
||||
TargetRegistry::lookupTarget(Trip.getTriple(), Error);
|
||||
#endif
|
||||
if (TheTarget == nullptr) {
|
||||
LLVMRustSetLastError(Error.c_str());
|
||||
return nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue