Skip to content

Commit b160477

Browse files
authored
Rollup merge of #138137 - ZequanWu:fix-triple, r=cuviper
setTargetTriple now accepts Triple rather than string llvm/llvm-project#129868 updated `setTargetTriple`
2 parents a29e3af + 8814679 commit b160477

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) {
152152
}
153153

154154
extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
155-
const char *Triple) {
156-
unwrap(M)->setTargetTriple(Triple::normalize(Triple));
155+
const char *Target) {
156+
#if LLVM_VERSION_GE(21, 0)
157+
unwrap(M)->setTargetTriple(Triple(Triple::normalize(Target)));
158+
#else
159+
unwrap(M)->setTargetTriple(Triple::normalize(Target));
160+
#endif
157161
}
158162

159163
extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) {

0 commit comments

Comments
 (0)