Skip to content

Commit

Permalink
Auto merge of rust-lang#83425 - durin42:llvm-update, r=nagisa
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
bors committed Apr 23, 2021
2 parents cb81dc5 + fc2a74c commit 236580b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,9 +1300,19 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {

DEFINE_SIMPLE_CONVERSION_FUNCTIONS(SMDiagnostic, LLVMSMDiagnosticRef)

#if LLVM_VERSION_LT(13, 0)
using LLVMInlineAsmDiagHandlerTy = LLVMContext::InlineAsmDiagHandlerTy;
#else
using LLVMInlineAsmDiagHandlerTy = void*;
#endif

extern "C" void LLVMRustSetInlineAsmDiagnosticHandler(
LLVMContextRef C, LLVMContext::InlineAsmDiagHandlerTy H, void *CX) {
LLVMContextRef C, LLVMInlineAsmDiagHandlerTy H, void *CX) {
// Diagnostic handlers were unified in LLVM change 5de2d189e6ad, so starting
// with LLVM 13 this function is gone.
#if LLVM_VERSION_LT(13, 0)
unwrap(C)->setInlineAsmDiagnosticHandler(H, CX);
#endif
}

extern "C" bool LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef,
Expand Down

0 comments on commit 236580b

Please sign in to comment.