aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorBalazs Benics <balazs.benics@sigmatechnology.se>2022-05-27 11:15:23 +0200
committerBalazs Benics <balazs.benics@sigmatechnology.se>2022-05-27 11:15:23 +0200
commit3988bd13988aad72ec979beb2361e8738584926b (patch)
treea84dd1303b916a2aac1d214b6af314a8ca873498 /llvm/lib/IR/Attributes.cpp
parentf13050eca3564ebccc04ea39eb34a312f063c4e9 (diff)
downloadllvm-3988bd13988aad72ec979beb2361e8738584926b.zip
llvm-3988bd13988aad72ec979beb2361e8738584926b.tar.gz
llvm-3988bd13988aad72ec979beb2361e8738584926b.tar.bz2
[llvm][clang][bolt][NFC] Use llvm::less_first() when applicable
One could reuse this functor instead of rolling out your own version. There were a couple other cases where the code was similar, but not quite the same, such as it might have an assertion in the lambda or other constructs. Thus, I've not touched any of those, as it might change the behavior in some way. As per https://discourse.llvm.org/t/submitting-simple-nfc-patches/62640/3?u=steakhal Chris Lattner > LLVM intentionally has a “yes, you can apply common sense judgement to > things” policy when it comes to code review. If you are doing mechanical > patches (e.g. adopting less_first) that apply to the entire monorepo, > then you don’t need everyone in the monorepo to sign off on it. Having > some +1 validation from someone is useful, but you don’t need everyone > whose code you touch to weigh in. Differential Revision: https://reviews.llvm.org/D126068
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 1aa2d44..31141cf 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1018,11 +1018,7 @@ AttributeList::get(LLVMContext &C,
if (Attrs.empty())
return {};
- assert(llvm::is_sorted(Attrs,
- [](const std::pair<unsigned, Attribute> &LHS,
- const std::pair<unsigned, Attribute> &RHS) {
- return LHS.first < RHS.first;
- }) &&
+ assert(llvm::is_sorted(Attrs, llvm::less_first()) &&
"Misordered Attributes list!");
assert(llvm::all_of(Attrs,
[](const std::pair<unsigned, Attribute> &Pair) {
@@ -1055,11 +1051,7 @@ AttributeList::get(LLVMContext &C,
if (Attrs.empty())
return {};
- assert(llvm::is_sorted(Attrs,
- [](const std::pair<unsigned, AttributeSet> &LHS,
- const std::pair<unsigned, AttributeSet> &RHS) {
- return LHS.first < RHS.first;
- }) &&
+ assert(llvm::is_sorted(Attrs, llvm::less_first()) &&
"Misordered Attributes list!");
assert(llvm::none_of(Attrs,
[](const std::pair<unsigned, AttributeSet> &Pair) {