diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-02-20 23:04:11 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-02-20 23:04:11 +0000 |
commit | 1c20ff028e6e85b34a40908f61cf13d6ae32505f (patch) | |
tree | 90cc2dff852489893999b25a04afff8d62e9d5e1 /llvm/lib/IR | |
parent | 4437ad7d94c6c11733ff9ed2db8d9dbc06e40ed3 (diff) | |
download | bcm5719-llvm-1c20ff028e6e85b34a40908f61cf13d6ae32505f.tar.gz bcm5719-llvm-1c20ff028e6e85b34a40908f61cf13d6ae32505f.zip |
Add and remove the attribute from the correct slot.
The slot that we're adding/removing the attribute from may not be the same as
the attribute coming in. Make sure that they match up before we try to
add/remove them.
PR15313
llvm-svn: 175684
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 839e496f92b..15c05e71e22 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -125,12 +125,22 @@ bool Argument::hasStructRetAttr() const { /// addAttr - Add attributes to an argument. void Argument::addAttr(AttributeSet AS) { - getParent()->addAttributes(getArgNo() + 1, AS); + assert(AS.getNumSlots() == 1 && + "Trying to add more than one attribute set to an argument!"); + AttrBuilder B(AS, AS.getSlotIndex(0)); + getParent()->addAttributes(getArgNo() + 1, + AttributeSet::get(Parent->getContext(), + getArgNo() + 1, B)); } /// removeAttr - Remove attributes from an argument. void Argument::removeAttr(AttributeSet AS) { - getParent()->removeAttributes(getArgNo() + 1, AS); + assert(AS.getNumSlots() == 1 && + "Trying to remove more than one attribute set from an argument!"); + AttrBuilder B(AS, AS.getSlotIndex(0)); + getParent()->removeAttributes(getArgNo() + 1, + AttributeSet::get(Parent->getContext(), + getArgNo() + 1, B)); } //===----------------------------------------------------------------------===// |