[llvm] r173992 - Remove addRetAttributes and addFnAttributes, which aren't useful abstractions.

Bill Wendling isanbard at gmail.com
Wed Jan 30 15:40:31 PST 2013


Author: void
Date: Wed Jan 30 17:40:31 2013
New Revision: 173992

URL: http://llvm.org/viewvc/llvm-project?rev=173992&view=rev
Log:
Remove addRetAttributes and addFnAttributes, which aren't useful abstractions.

Modified:
    llvm/trunk/include/llvm/IR/Attributes.h
    llvm/trunk/lib/IR/Core.cpp
    llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
    llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp

Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=173992&r1=173991&r2=173992&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Wed Jan 30 17:40:31 2013
@@ -230,18 +230,6 @@ public:
   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 {
-    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 {
-    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
   /// list.

Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=173992&r1=173991&r2=173992&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Wed Jan 30 17:40:31 2013
@@ -1383,9 +1383,9 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn
   const AttributeSet PAL = Func->getAttributes();
   AttrBuilder B(PA);
   const AttributeSet PALnew =
-    PAL.addFnAttributes(Func->getContext(),
-                        AttributeSet::get(Func->getContext(),
-                                          AttributeSet::FunctionIndex, B));
+    PAL.addAttributes(Func->getContext(), AttributeSet::FunctionIndex,
+                      AttributeSet::get(Func->getContext(),
+                                        AttributeSet::FunctionIndex, B));
   Func->setAttributes(PALnew);
 }
 

Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=173992&r1=173991&r2=173992&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Wed Jan 30 17:40:31 2013
@@ -147,10 +147,10 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC
       Function *F = (*I)->getFunction();
       const AttributeSet &PAL = F->getAttributes();
       const AttributeSet &NPAL =
-        PAL.addFnAttributes(F->getContext(),
-                            AttributeSet::get(F->getContext(),
-                                              AttributeSet::FunctionIndex,
-                                              NewAttributes));
+        PAL.addAttributes(F->getContext(), AttributeSet::FunctionIndex,
+                          AttributeSet::get(F->getContext(),
+                                            AttributeSet::FunctionIndex,
+                                            NewAttributes));
       if (PAL != NPAL) {
         MadeChange = true;
         F->setAttributes(NPAL);

Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=173992&r1=173991&r2=173992&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Wed Jan 30 17:40:31 2013
@@ -98,11 +98,13 @@ void llvm::CloneFunctionInto(Function *N
         Anew->addAttr(OldFunc->getAttributes()
                        .getParamAttributes(I->getArgNo() + 1));
     NewFunc->setAttributes(NewFunc->getAttributes()
-                           .addRetAttributes(NewFunc->getContext(),
-                                             OldFunc->getAttributes()));
+                           .addAttributes(NewFunc->getContext(),
+                                          AttributeSet::ReturnIndex,
+                                          OldFunc->getAttributes()));
     NewFunc->setAttributes(NewFunc->getAttributes()
-                           .addFnAttributes(NewFunc->getContext(),
-                                            OldFunc->getAttributes()));
+                           .addAttributes(NewFunc->getContext(),
+                                          AttributeSet::FunctionIndex,
+                                          OldFunc->getAttributes()));
 
   }
 





More information about the llvm-commits mailing list