[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 14:34:56 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL267057: Add utility function to manipulate attributes on CallSite. NFC (authored by deadalnix).

Changed prior to commit:
  http://reviews.llvm.org/D19173?vs=54525&id=54579#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19173

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

Index: llvm/trunk/lib/IR/Instructions.cpp
===================================================================
--- llvm/trunk/lib/IR/Instructions.cpp
+++ llvm/trunk/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: llvm/trunk/include/llvm/IR/CallSite.h
===================================================================
--- llvm/trunk/include/llvm/IR/CallSite.h
+++ llvm/trunk/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));
Index: llvm/trunk/include/llvm/IR/Instructions.h
===================================================================
--- llvm/trunk/include/llvm/IR/Instructions.h
+++ llvm/trunk/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.


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


More information about the llvm-commits mailing list