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 d345261
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion 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::StructRet);
#else
r->addAttribute(idx, Attribute::getWithStructRetType(*CU->TT->ctx, ty));
#endif
r->addAttribute(idx, Attribute::NoAlias);
}
template <typename FnOrCall>
void addByValAttr(FnOrCall *r, int idx, Type* ty) {
r->addAttribute(idx, llvm::Attribute::getWithByValType(*CU->TT->ctx, ty));
#if LLVM_VERSION < 120
r->addAttribute(idx, Attribute::ByVal);
#else
r->addAttribute(idx, Attribute::getWithByValType(*CU->TT->ctx, ty));
#endif
}
template <typename FnOrCall>
void addExtAttrIfNeeded(TType *t, FnOrCall *r, int idx) {
Expand Down

0 comments on commit d345261

Please sign in to comment.