[llvm] r173742 - Convert the AttrBuilder into a list of Attributes instead of one Attribute object that holds all of its attributes.
Bill Wendling
isanbard at gmail.com
Mon Jan 28 17:02:04 PST 2013
Author: void
Date: Mon Jan 28 19:02:03 2013
New Revision: 173742
URL: http://llvm.org/viewvc/llvm-project?rev=173742&view=rev
Log:
Convert the AttrBuilder into a list of Attributes instead of one Attribute object that holds all of its attributes.
Modified:
llvm/trunk/lib/IR/Attributes.cpp
Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=173742&r1=173741&r2=173742&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Mon Jan 28 19:02:03 2013
@@ -445,8 +445,21 @@ AttributeSet AttributeSet::get(LLVMConte
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,
More information about the llvm-commits
mailing list