[PATCH] D149192: [IR] Add interface to remove a CallBase string function attribute
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 08:45:25 PDT 2023
tejohnson updated this revision to Diff 517194.
tejohnson added a comment.
Address comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149192/new/
https://reviews.llvm.org/D149192
Files:
llvm/include/llvm/IR/InstrTypes.h
llvm/unittests/IR/InstructionsTest.cpp
Index: llvm/unittests/IR/InstructionsTest.cpp
===================================================================
--- llvm/unittests/IR/InstructionsTest.cpp
+++ llvm/unittests/IR/InstructionsTest.cpp
@@ -102,6 +102,11 @@
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) {
Index: llvm/include/llvm/IR/InstrTypes.h
===================================================================
--- llvm/include/llvm/IR/InstrTypes.h
+++ llvm/include/llvm/IR/InstrTypes.h
@@ -1559,6 +1559,11 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149192.517194.patch
Type: text/x-patch
Size: 1259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230426/a12aae84/attachment-0001.bin>
More information about the llvm-commits
mailing list