From 70d2ca0725b05a2d372e4dc3336e8ea350093e98 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 23 Jan 2013 00:20:53 +0000 Subject: Use the AttributeSet when adding multiple attributes and an Attribute::AttrKind when adding a single attribute to the function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173210 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Function.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib/IR/Function.cpp') diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp index 6a5e61611c..4d047f6443 100644 --- a/lib/IR/Function.cpp +++ b/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); } -- cgit v1.2.3-70-g09d2