aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-23 00:20:53 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-23 00:20:53 +0000
commitc0e2a1f4575520fcf1b202c838250d2623e23cd2 (patch)
treecd60385b64d0fc725f90fa818c7621543a8cee59 /llvm/lib/IR/Function.cpp
parentf71baa84eaca687c06dc44cc1a4349c8a344c48f (diff)
downloadllvm-c0e2a1f4575520fcf1b202c838250d2623e23cd2.zip
llvm-c0e2a1f4575520fcf1b202c838250d2623e23cd2.tar.gz
llvm-c0e2a1f4575520fcf1b202c838250d2623e23cd2.tar.bz2
Use the AttributeSet when adding multiple attributes and an Attribute::AttrKind
when adding a single attribute to the function. llvm-svn: 173210
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 6a5e616..4d047f6 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -125,7 +125,10 @@ bool Argument::hasStructRetAttr() const {
/// addAttr - Add a Attribute to an argument
void Argument::addAttr(Attribute attr) {
- getParent()->addAttribute(getArgNo() + 1, attr);
+ AttrBuilder B(attr);
+ getParent()->addAttributes(getArgNo() + 1,
+ AttributeSet::get(getParent()->getContext(),
+ getArgNo() + 1, B));
}
/// removeAttr - Remove a Attribute from an argument
@@ -248,17 +251,21 @@ void Function::dropAllReferences() {
BasicBlocks.begin()->eraseFromParent();
}
-void Function::addAttribute(unsigned i, Attribute attr) {
+void Function::addAttribute(unsigned i, Attribute::AttrKind attr) {
AttributeSet PAL = getAttributes();
- AttrBuilder B(attr);
- PAL = PAL.addAttributes(getContext(), i,
- AttributeSet::get(getContext(), i, B));
+ PAL = PAL.addAttribute(getContext(), i, attr);
+ setAttributes(PAL);
+}
+
+void Function::addAttributes(unsigned i, AttributeSet attrs) {
+ AttributeSet PAL = getAttributes();
+ PAL = PAL.addAttributes(getContext(), i, attrs);
setAttributes(PAL);
}
-void Function::removeAttribute(unsigned i, Attribute attr) {
+void Function::removeAttribute(unsigned i, Attribute attrs) {
AttributeSet PAL = getAttributes();
- PAL = PAL.removeAttr(getContext(), i, attr);
+ PAL = PAL.removeAttr(getContext(), i, attrs);
setAttributes(PAL);
}