summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-29 01:02:03 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-29 01:02:03 +0000
commitf71348171849b4ed77e6789eb4b8a7d339d4246f (patch)
tree412c0c56b2607a422c4158adc0f3e9fe32fb9934
parentadfb7eb211e7003ac639217e27886aeabaf063ea (diff)
downloadbcm5719-llvm-f71348171849b4ed77e6789eb4b8a7d339d4246f.tar.gz
bcm5719-llvm-f71348171849b4ed77e6789eb4b8a7d339d4246f.zip
Convert the AttrBuilder into a list of Attributes instead of one Attribute object that holds all of its attributes.
llvm-svn: 173742
-rw-r--r--llvm/lib/IR/Attributes.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 0bc926271ae..d947ffffd8f 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -445,8 +445,21 @@ AttributeSet AttributeSet::get(LLVMContext &C,
AttributeSet AttributeSet::get(LLVMContext &C, unsigned Idx, AttrBuilder &B) {
if (!B.hasAttributes())
return AttributeSet();
- return get(C, ArrayRef<std::pair<unsigned, Attribute> >(
- std::make_pair(Idx, Attribute::get(C, B))));
+
+ SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
+ for (AttrBuilder::iterator I = B.begin(), E = B.end(); I != E; ++I) {
+ Attribute::AttrKind Kind = *I;
+ if (Kind == Attribute::Alignment)
+ Attrs.push_back(std::make_pair(Idx, Attribute::
+ getWithAlignment(C, B.getAlignment())));
+ else if (Kind == Attribute::StackAlignment)
+ Attrs.push_back(std::make_pair(Idx, Attribute::
+ getWithStackAlignment(C, B.getStackAlignment())));
+ else
+ Attrs.push_back(std::make_pair(Idx, Attribute::get(C, Kind)));
+ }
+
+ return get(C, Attrs);
}
AttributeSet AttributeSet::get(LLVMContext &C, unsigned Idx,
OpenPOWER on IntegriCloud