Skip to content

Commit

Permalink
llvm-wrapper: adapt for LLVM API change
Browse files Browse the repository at this point in the history
  • Loading branch information
krasimirgg committed Jul 12, 2022
1 parent 1c7b36d commit a89d014
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,14 @@ LLVMRustInlineAsm(LLVMTypeRef Ty, char *AsmString, size_t AsmStringLen,

extern "C" bool LLVMRustInlineAsmVerify(LLVMTypeRef Ty, char *Constraints,
size_t ConstraintsLen) {
#if LLVM_VERSION_LT(15, 0)
return InlineAsm::Verify(unwrap<FunctionType>(Ty),
StringRef(Constraints, ConstraintsLen));
#else
// llvm::Error converts to true if it is an error.
return !llvm::errorToBool(InlineAsm::verify(
unwrap<FunctionType>(Ty), StringRef(Constraints, ConstraintsLen)));
#endif
}

extern "C" void LLVMRustAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm,
Expand Down

0 comments on commit a89d014

Please sign in to comment.