diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/IR/CallSite.h | 16 | ||||
| -rw-r--r-- | llvm/include/llvm/IR/Instructions.h | 6 | ||||
| -rw-r--r-- | llvm/lib/IR/Instructions.cpp | 12 |
3 files changed, 34 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/CallSite.h b/llvm/include/llvm/IR/CallSite.h index 2bd836fd794..ad66cfbfaad 100644 --- a/llvm/include/llvm/IR/CallSite.h +++ b/llvm/include/llvm/IR/CallSite.h @@ -305,6 +305,22 @@ public: 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)); diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 19ea3464a10..63175ed8b3f 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -1604,6 +1604,9 @@ public: 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 @@ public: 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. diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 4f2fbeef5cb..65703d13ec0 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -343,6 +343,12 @@ void CallInst::addAttribute(unsigned i, StringRef Kind, StringRef Value) { 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 @@ void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind attr) { 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); |

