Skip to content

Commit

Permalink
Add LLVM 12 checks around typed ByVal/SRet attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcd1230 committed Jul 19, 2021
1 parent 0de11ce commit 464fce4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,12 +958,20 @@ struct CCallingConv {

template <typename FnOrCall>
void addSRetAttr(FnOrCall *r, int idx, Type* ty) {
#if LLVM_VERSION < 120
r->addAttribute(idx, Attribute::SRet);
#else
r->addAttribute(idx, Attribute::getWithStructRetType(*CU->TT->ctx, ty));
#end
r->addAttribute(idx, Attribute::NoAlias);
}
template <typename FnOrCall>
void addByValAttr(FnOrCall *r, int idx, Type* ty) {
#if LLVM_VERSION < 120
r->addAttribute(idx, llvm::Attribute::ByVal);
#else
r->addAttribute(idx, llvm::Attribute::getWithByValType(*CU->TT->ctx, ty));
#endif
}
template <typename FnOrCall>
void addExtAttrIfNeeded(TType *t, FnOrCall *r, int idx) {
Expand Down

0 comments on commit 464fce4

Please sign in to comment.