From 145e1b5b241121f660ca9c7683fa7bd5ea17790b Mon Sep 17 00:00:00 2001 From: kai Date: Mon, 28 Jan 2013 19:20:57 +0100 Subject: [PATCH] AttributeSet::get(... AttributeWithIndex ...) is now private. AttributeWithIndex is really going away in LLVM 3.3. This is a horrible hack to keep everything compiling. Attribute handling needs some rework. --- gen/functions.cpp | 10 ++++++++-- gen/tocall.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index b8d70f0c..7a206a30 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -648,8 +648,14 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati } #if LDC_LLVM_VER >= 303 - llvm::AttributeSet attrlist = llvm::AttributeSet::get(gIR->context(), - llvm::ArrayRef(attrs)); + // FIXME: This is horrible inefficient. The real fix is to use AttributeSet + // right from the beginning. + llvm::AttributeSet attrlist; + for (llvm::SmallVector::iterator I = attrs.begin(), E = attrs.end(); I != E; ++I) + { + llvm::AttributeSet tmp = llvm::AttributeSet::get(gIR->context(), (*I).Index, llvm::AttrBuilder().addAttributes((*I).Attrs)); + attrlist = attrlist.addAttributes(gIR->context(), (*I).Index, tmp); + } #elif LDC_LLVM_VER >= 302 llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(gIR->context(), llvm::ArrayRef(attrs)); diff --git a/gen/tocall.cpp b/gen/tocall.cpp index cd343820..8e1c1bcb 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -752,8 +752,14 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* // set calling convention and parameter attributes #if LDC_LLVM_VER >= 303 - llvm::AttributeSet attrlist = llvm::AttributeSet::get(gIR->context(), - llvm::ArrayRef(attrs)); + // FIXME: This is horrible inefficient. The real fix is to use AttributeSet + // right from the beginning. + llvm::AttributeSet attrlist; + for (std::vector::iterator I = attrs.begin(), E = attrs.end(); I != E; ++I) + { + llvm::AttributeSet tmp = llvm::AttributeSet::get(gIR->context(), (*I).Index, llvm::AttrBuilder().addAttributes((*I).Attrs)); + attrlist = attrlist.addAttributes(gIR->context(), (*I).Index, tmp); + } #elif LDC_LLVM_VER == 302 llvm::AttrListPtr attrlist = llvm::AttrListPtr::get(gIR->context(), llvm::ArrayRef(attrs));