Add a new method that adds the AttributeSet at the given index. No functional change.
authorBill Wendling <isanbard@gmail.com>
Tue, 22 Jan 2013 00:53:12 +0000 (00:53 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 22 Jan 2013 00:53:12 +0000 (00:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173109 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Attributes.h
lib/IR/Attributes.cpp

index ef80b4d46385b99f49eb2823a694240f9398db90..c1146612cd29347b70ceb8472dc83d101d05c803 100644 (file)
@@ -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
index fe6366de790941e1522e52548e384fbe61e52d6c..420b2e8ff74d61203ef7963b5a4dfb55bb3ae81c 100644 (file)
@@ -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,