Skip to content

[clang-tools-extra] Use llvm::find_if (NFC) #140411

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
31 changes: 15 additions & 16 deletions clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,21 @@ void NewDeleteOverloadsCheck::onEndOfTranslationUnit() {
// complexity when searching for corresponding free store functions.
for (const auto *Overload : RP.second) {
const auto *Match =
std::find_if(RP.second.begin(), RP.second.end(),
[&Overload](const FunctionDecl *FD) {
if (FD == Overload)
return false;
// If the declaration contexts don't match, we don't
// need to check any further.
if (FD->getDeclContext() != Overload->getDeclContext())
return false;

// Since the declaration contexts match, see whether
// the current element is the corresponding operator.
if (!areCorrespondingOverloads(Overload, FD))
return false;

return true;
});
llvm::find_if(RP.second, [&Overload](const FunctionDecl *FD) {
if (FD == Overload)
return false;
// If the declaration contexts don't match, we don't
// need to check any further.
if (FD->getDeclContext() != Overload->getDeclContext())
return false;

// Since the declaration contexts match, see whether
// the current element is the corresponding operator.
if (!areCorrespondingOverloads(Overload, FD))
return false;

return true;
});

if (Match == RP.second.end()) {
// Check to see if there is a corresponding overload in a base class
Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clangd/refactor/Rename.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ void filterRenameTargets(llvm::DenseSet<const NamedDecl *> &Decls) {
// For renaming, we're only interested in foo's declaration, so drop the other
// one. There should never be more than one UsingDecl here, otherwise the
// rename would be ambiguos anyway.
auto UD = std::find_if(Decls.begin(), Decls.end(), [](const NamedDecl *D) {
return llvm::isa<UsingDecl>(D);
});
auto UD = llvm::find_if(
Decls, [](const NamedDecl *D) { return llvm::isa<UsingDecl>(D); });
if (UD != Decls.end()) {
Decls.erase(UD);
}
Expand Down
Loading