Adds an interface to remove a string function attribute attached to a
CallBase, and a corresponding unittest.
This was extracted from D141077, and will be used by a follow on patch
that removes memprof attributes when needed.
Reviewed By: snehasish
Differential Revision: https://reviews.llvm.org/D149192
Attrs = Attrs.removeFnAttribute(getContext(), Kind);
}
+ /// Removes the attribute from the function
+ void removeFnAttr(StringRef Kind) {
+ Attrs = Attrs.removeFnAttribute(getContext(), Kind);
+ }
+
/// Removes the attribute from the return value
void removeRetAttr(Attribute::AttrKind Kind) {
Attrs = Attrs.removeRetAttribute(getContext(), Kind);
Call->addRetAttr(Attribute::get(Call->getContext(), "test-str-attr"));
EXPECT_TRUE(Call->hasRetAttr("test-str-attr"));
EXPECT_FALSE(Call->hasRetAttr("not-on-call"));
+
+ Call->addFnAttr(Attribute::get(Call->getContext(), "test-str-fn-attr"));
+ ASSERT_TRUE(Call->hasFnAttr("test-str-fn-attr"));
+ Call->removeFnAttr("test-str-fn-attr");
+ EXPECT_FALSE(Call->hasFnAttr("test-str-fn-attr"));
}
TEST_F(ModuleWithFunctionTest, InvokeInst) {