Skip to content

Commit 236580b

Browse files
committed
Auto merge of #83425 - durin42:llvm-update, r=nagisa
RustWrapper: work around unification of diagnostic handlers This lets me build against llvm/main as of March 23rd, 2021. I'm not entirely sure this is _correct_, but it appears to be functionally identical to what was done in LLVM: existing callsites of setInlineAsmDiagnosticHandler were moved to SetDiagnosticHandler() on the context object, which we already set up in both places that we called setInlineAsmDiagnosticHandler().
2 parents cb81dc5 + fc2a74c commit 236580b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -1300,9 +1300,19 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {
13001300

13011301
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(SMDiagnostic, LLVMSMDiagnosticRef)
13021302

1303+
#if LLVM_VERSION_LT(13, 0)
1304+
using LLVMInlineAsmDiagHandlerTy = LLVMContext::InlineAsmDiagHandlerTy;
1305+
#else
1306+
using LLVMInlineAsmDiagHandlerTy = void*;
1307+
#endif
1308+
13031309
extern "C" void LLVMRustSetInlineAsmDiagnosticHandler(
1304-
LLVMContextRef C, LLVMContext::InlineAsmDiagHandlerTy H, void *CX) {
1310+
LLVMContextRef C, LLVMInlineAsmDiagHandlerTy H, void *CX) {
1311+
// Diagnostic handlers were unified in LLVM change 5de2d189e6ad, so starting
1312+
// with LLVM 13 this function is gone.
1313+
#if LLVM_VERSION_LT(13, 0)
13051314
unwrap(C)->setInlineAsmDiagnosticHandler(H, CX);
1315+
#endif
13061316
}
13071317

13081318
extern "C" bool LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef,

0 commit comments

Comments
 (0)