Skip to content

[clang-tools-extra] Use llvm::max_element (NFC) #140458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ int main(int argc, char *argv[]) {
llvm::sort(Entries);

unsigned LargestValue =
std::max_element(Entries.begin(), Entries.end(),
[](const auto &Entry0, const auto &Entry1) {
return Entry0.second.size() < Entry1.second.size();
})
->second.size();
llvm::max_element(Entries, [](const auto &Entry0, const auto &Entry1) {
return Entry0.second.size() < Entry1.second.size();
})->second.size();

std::error_code Ec;
llvm::raw_fd_ostream Os(argv[2], Ec);
Expand Down
9 changes: 4 additions & 5 deletions clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,10 @@ static void addPlaceholderArgs(const LambdaProperties &LP,

ArrayRef<BindArgument> Args = LP.BindArguments;

const auto *MaxPlaceholderIt =
std::max_element(Args.begin(), Args.end(),
[](const BindArgument &B1, const BindArgument &B2) {
return B1.PlaceHolderIndex < B2.PlaceHolderIndex;
});
const auto *MaxPlaceholderIt = llvm::max_element(
Args, [](const BindArgument &B1, const BindArgument &B2) {
return B1.PlaceHolderIndex < B2.PlaceHolderIndex;
});

// Placeholders (if present) have index 1 or greater.
if (!PermissiveParameterList && (MaxPlaceholderIt == Args.end() ||
Expand Down
Loading