From eb9c0ec26e18d6e93699a20e8733a8ae72eb5510 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 22 Jan 2013 00:53:12 +0000 Subject: [PATCH] Add a new method that adds the AttributeSet at the given index. No functional change. llvm-svn: 173109 --- llvm/include/llvm/IR/Attributes.h | 13 +++++++++++-- llvm/lib/IR/Attributes.cpp | 11 +++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h index ef80b4d..c114661 100644 --- a/llvm/include/llvm/IR/Attributes.h +++ b/llvm/include/llvm/IR/Attributes.h @@ -231,13 +231,22 @@ public: /// list. AttributeSet addAttr(LLVMContext &C, unsigned Idx, Attribute Attrs) const; + /// \brief Add attributes to the attribute set at the given index. Since + /// attribute sets are immutable, this returns a new set. + AttributeSet addAttributes(LLVMContext &C, unsigned Idx, + AttributeSet Attrs) const; + /// \brief Add return attributes to this attribute set. Since attribute sets /// are immutable, this returns a new set. - AttributeSet addRetAttributes(LLVMContext &C, AttributeSet Attrs) const; + AttributeSet addRetAttributes(LLVMContext &C, AttributeSet Attrs) const { + return addAttributes(C, ReturnIndex, Attrs); + } /// \brief Add function attributes to this attribute set. Since attribute sets /// are immutable, this returns a new set. - AttributeSet addFnAttributes(LLVMContext &C, AttributeSet Attrs) const; + AttributeSet addFnAttributes(LLVMContext &C, AttributeSet Attrs) const { + return addAttributes(C, FunctionIndex, Attrs); + } /// \brief Remove the specified attribute at the specified index from this /// attribute list. Since attribute lists are immutable, this returns the new diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index fe6366d..420b2e8 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -691,14 +691,9 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const { return false; } -AttributeSet AttributeSet::addRetAttributes(LLVMContext &C, - AttributeSet Attrs) const { - return addAttr(C, ReturnIndex, Attrs.getAttributes(ReturnIndex)); -} - -AttributeSet AttributeSet::addFnAttributes(LLVMContext &C, - AttributeSet Attrs) const { - return addAttr(C, FunctionIndex, Attrs.getAttributes(FunctionIndex)); +AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Idx, + AttributeSet Attrs) const { + return addAttr(C, Idx, Attrs.getAttributes(Idx)); } AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx, -- 2.7.4