From 1a06130cfacc06a8351611c1197ab060001e333f Mon Sep 17 00:00:00 2001 From: kai Date: Sun, 9 Dec 2012 19:48:39 +0100 Subject: [PATCH] AttrListPtr is renamed to AttributeSet in LLVM 3.3. --- gen/functions.cpp | 9 ++++++++- gen/llvmhelpers.h | 4 ++++ gen/runtime.cpp | 4 ++++ gen/tocall.cpp | 5 ++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index c74c8944..9d54407e 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -567,7 +567,11 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati // Merge in any old attributes (attributes for the function itself are // also stored in a list slot). const size_t newSize = attrs.size(); +#if LDC_LLVM_VER >= 303 + llvm::AttributeSet oldAttrs = func->getAttributes(); +#else llvm::AttrListPtr oldAttrs = func->getAttributes(); +#endif for (size_t i = 0; i < oldAttrs.getNumSlots(); ++i) { llvm::AttributeWithIndex curr = oldAttrs.getSlot(i); @@ -591,7 +595,10 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati } } -#if LDC_LLVM_VER >= 302 +#if LDC_LLVM_VER >= 303 + llvm::AttributeSet attrlist = llvm::AttributeSet::get(gIR->context(), + llvm::ArrayRef(attrs)); +#elif LDC_LLVM_VER >= 302 llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(gIR->context(), llvm::ArrayRef(attrs)); #else diff --git a/gen/llvmhelpers.h b/gen/llvmhelpers.h index 4cecf41e..e911aad3 100644 --- a/gen/llvmhelpers.h +++ b/gen/llvmhelpers.h @@ -191,7 +191,11 @@ LLValue* DtoCallableValue(DValue* fn); LLFunctionType* DtoExtractFunctionType(LLType* type); /// +#if LDC_LLVM_VER >= 303 +void DtoBuildDVarArgList(std::vector& args, llvm::AttributeSet& palist, TypeFunction* tf, Expressions* arguments, size_t argidx); +#else void DtoBuildDVarArgList(std::vector& args, llvm::AttrListPtr& palist, TypeFunction* tf, Expressions* arguments, size_t argidx); +#endif /// DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* arguments); diff --git a/gen/runtime.cpp b/gen/runtime.cpp index 1bd0429c..0bf9d0e0 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -220,7 +220,11 @@ static void LLVM_D_BuildRuntimeModule() // Construct some attribute lists used below (possibly multiple times) #if LDC_LLVM_VER >= 302 +#if LDC_LLVM_VER >= 303 + llvm::AttributeSet +#else llvm::AttrListPtr +#endif NoAttrs, Attr_NoAlias = NoAttrs.addAttr(gIR->context(), 0, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoAlias))), diff --git a/gen/tocall.cpp b/gen/tocall.cpp index 8aef0590..d5c6e8ca 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -717,7 +717,10 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* } // set calling convention and parameter attributes -#if LDC_LLVM_VER >= 302 +#if LDC_LLVM_VER >= 303 + llvm::AttributeSet attrlist = llvm::AttributeSet::get(gIR->context(), + llvm::ArrayRef(attrs)); +#elif LDC_LLVM_VER == 302 llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(gIR->context(), llvm::ArrayRef(attrs)); #else