[PATCH] D19173: Add utility function to manipulate attributes on CallSite. NFC
Amaury SECHET via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 12:40:01 PDT 2016
deadalnix created this revision.
deadalnix added reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael.
deadalnix added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.
As per title. This will help work on the C API.
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
@@ -1683,6 +1683,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.
@@ -3621,6 +3624,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.53932.patch
Type: text/x-patch
Size: 2847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160415/b29119f3/attachment.bin>
More information about the llvm-commits
mailing list