[PATCH] D19173: Add utility function to manipulate attributes on CallSite. NFC

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 10:11:58 PDT 2016


deadalnix updated this revision to Diff 54525.
deadalnix added a comment.

ping


http://reviews.llvm.org/D19173

Files:
  include/llvm/IR/CallSite.h
  include/llvm/IR/Instructions.h
  lib/IR/Instructions.cpp

Index: lib/IR/Instructions.cpp
===================================================================
--- lib/IR/Instructions.cpp
+++ lib/IR/Instructions.cpp
@@ -343,6 +343,12 @@
   setAttributes(PAL);
 }
 
+void CallInst::removeAttribute(unsigned i, Attribute::AttrKind attr) {
+  AttributeSet PAL = getAttributes();
+  PAL = PAL.removeAttribute(getContext(), i, attr);
+  setAttributes(PAL);
+}
+
 void CallInst::removeAttribute(unsigned i, Attribute attr) {
   AttributeSet PAL = getAttributes();
   AttrBuilder B(attr);
@@ -663,6 +669,12 @@
   setAttributes(PAL);
 }
 
+void InvokeInst::removeAttribute(unsigned i, Attribute::AttrKind attr) {
+  AttributeSet PAL = getAttributes();
+  PAL = PAL.removeAttribute(getContext(), i, attr);
+  setAttributes(PAL);
+}
+
 void InvokeInst::removeAttribute(unsigned i, Attribute attr) {
   AttributeSet PAL = getAttributes();
   AttrBuilder B(attr);
Index: include/llvm/IR/Instructions.h
===================================================================
--- include/llvm/IR/Instructions.h
+++ include/llvm/IR/Instructions.h
@@ -1604,6 +1604,9 @@
   void addAttribute(unsigned i, StringRef Kind, StringRef Value);
 
   /// removeAttribute - removes the attribute from the list of attributes.
+  void removeAttribute(unsigned i, Attribute::AttrKind attr);
+
+  /// removeAttribute - removes the attribute from the list of attributes.
   void removeAttribute(unsigned i, Attribute attr);
 
   /// \brief adds the dereferenceable attribute to the list of attributes.
@@ -3542,6 +3545,9 @@
   void addAttribute(unsigned i, Attribute::AttrKind attr);
 
   /// removeAttribute - removes the attribute from the list of attributes.
+  void removeAttribute(unsigned i, Attribute::AttrKind attr);
+
+  /// removeAttribute - removes the attribute from the list of attributes.
   void removeAttribute(unsigned i, Attribute attr);
 
   /// \brief adds the dereferenceable attribute to the list of attributes.
Index: include/llvm/IR/CallSite.h
===================================================================
--- include/llvm/IR/CallSite.h
+++ include/llvm/IR/CallSite.h
@@ -305,6 +305,22 @@
     CALLSITE_DELEGATE_SETTER(setAttributes(PAL));
   }
 
+  void addAttribute(unsigned i, Attribute::AttrKind attr) {
+    CALLSITE_DELEGATE_SETTER(addAttribute(i, attr));
+  }
+
+  void addAttribute(unsigned i, StringRef Kind, StringRef Value) {
+    CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind, Value));
+  }
+
+  void removeAttribute(unsigned i, Attribute::AttrKind attr) {
+    CALLSITE_DELEGATE_SETTER(removeAttribute(i, attr));
+  }
+
+  void removeAttribute(unsigned i, Attribute attr) {
+    CALLSITE_DELEGATE_SETTER(removeAttribute(i, attr));
+  }
+
   /// \brief Return true if this function has the given attribute.
   bool hasFnAttr(Attribute::AttrKind A) const {
     CALLSITE_DELEGATE_GETTER(hasFnAttr(A));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19173.54525.patch
Type: text/x-patch
Size: 2847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/5353f158/attachment.bin>


More information about the llvm-commits mailing list