diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2022-01-15 17:55:12 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2022-01-15 17:57:18 +0100 |
commit | d1675e494411050bd3b56ae55ff9c6fd93349c37 (patch) | |
tree | 9db83c2346c415bb2b382840c327ea60d2b8b7d2 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | e00158ed5c5dfd15497751941b740f814de065ac (diff) | |
download | llvm-d1675e494411050bd3b56ae55ff9c6fd93349c37.zip llvm-d1675e494411050bd3b56ae55ff9c6fd93349c37.tar.gz llvm-d1675e494411050bd3b56ae55ff9c6fd93349c37.tar.bz2 |
[AttrBuilder] Remove empty() / td_empty() methods
The empty() method is a footgun: It only checks whether there are
non-string attributes, which is not at all obvious from its name,
and of dubious usefulness. td_empty() is entirely unused.
Drop these methods in favor of hasAttributes(), which checks
whether there are any attributes, regardless of whether these are
string or enum attributes.
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index ae9bc09..bbd751d 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1186,7 +1186,7 @@ static bool MayContainThrowingOrExitingCall(Instruction *Begin, static AttrBuilder IdentifyValidAttributes(CallBase &CB) { AttrBuilder AB(CB.getContext(), CB.getAttributes(), AttributeList::ReturnIndex); - if (AB.empty()) + if (!AB.hasAttributes()) return AB; AttrBuilder Valid(CB.getContext()); // Only allow these white listed attributes to be propagated back to the @@ -1208,7 +1208,7 @@ static void AddReturnAttributes(CallBase &CB, ValueToValueMapTy &VMap) { return; AttrBuilder Valid = IdentifyValidAttributes(CB); - if (Valid.empty()) + if (!Valid.hasAttributes()) return; auto *CalledFunction = CB.getCalledFunction(); auto &Context = CalledFunction->getContext(); |