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.
This commit is contained in:
kai
2013-01-28 19:20:57 +01:00
parent e7e699870e
commit 145e1b5b24
2 changed files with 16 additions and 4 deletions

View File

@@ -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<llvm::AttributeWithIndex>(attrs));
// FIXME: This is horrible inefficient. The real fix is to use AttributeSet
// right from the beginning.
llvm::AttributeSet attrlist;
for (llvm::SmallVector<llvm::AttributeWithIndex, 9>::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<llvm::AttributeWithIndex>(attrs));

View File

@@ -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<llvm::AttributeWithIndex>(attrs));
// FIXME: This is horrible inefficient. The real fix is to use AttributeSet
// right from the beginning.
llvm::AttributeSet attrlist;
for (std::vector<llvm::AttributeWithIndex>::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<llvm::AttributeWithIndex>(attrs));