Add functions for adding and testing string attributes to CallInst. NFC.
This change is needed later when I make changes to attach string function
attributes to llvm.trap and llvm.debugtrap.
llvm-svn: 241304
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 1e43803..86c921a 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -292,6 +292,12 @@
setAttributes(PAL);
}
+void CallInst::addAttribute(unsigned i, StringRef Kind, StringRef Value) {
+ AttributeSet PAL = getAttributes();
+ PAL = PAL.addAttribute(getContext(), i, Kind, Value);
+ setAttributes(PAL);
+}
+
void CallInst::removeAttribute(unsigned i, Attribute attr) {
AttributeSet PAL = getAttributes();
AttrBuilder B(attr);
@@ -313,14 +319,6 @@
setAttributes(PAL);
}
-bool CallInst::hasFnAttrImpl(Attribute::AttrKind A) const {
- if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, A))
- return true;
- if (const Function *F = getCalledFunction())
- return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A);
- return false;
-}
-
bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const {
if (AttributeList.hasAttribute(i, A))
return true;