Skip to content

Commit

Permalink
Rollup merge of rust-lang#99185 - krasimirgg:llvm-wrapper-inlineasm, …
Browse files Browse the repository at this point in the history
…r=nikic

llvm-wrapper: adapt for LLVM API change

This adapts RustWrapper's ` LLVMRustInlineAsmVerify` for LLVM commit llvm/llvm-project@00797b8.
  • Loading branch information
Dylan-DPC authored Jul 13, 2022
2 parents cd22818 + a89d014 commit d5a58a8
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 d5a58a8

Please sign in to comment.