From 464fce49120d52fb7b870a3837115dd630838c4f Mon Sep 17 00:00:00 2001 From: Jason Dogariu Date: Sun, 18 Jul 2021 20:11:05 -0400 Subject: [PATCH] Add LLVM 12 checks around typed ByVal/SRet attrs --- src/tcompiler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tcompiler.cpp b/src/tcompiler.cpp index db50fce10..2a9193b9a 100644 --- a/src/tcompiler.cpp +++ b/src/tcompiler.cpp @@ -958,12 +958,20 @@ struct CCallingConv { template 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 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 void addExtAttrIfNeeded(TType *t, FnOrCall *r, int idx) {