Skip to content

Commit 1a40edf

Browse files
[clang-tools-extra] Use llvm::find_if (NFC) (#140411)
1 parent bc6107a commit 1a40edf

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,21 @@ void NewDeleteOverloadsCheck::onEndOfTranslationUnit() {
168168
// complexity when searching for corresponding free store functions.
169169
for (const auto *Overload : RP.second) {
170170
const auto *Match =
171-
std::find_if(RP.second.begin(), RP.second.end(),
172-
[&Overload](const FunctionDecl *FD) {
173-
if (FD == Overload)
174-
return false;
175-
// If the declaration contexts don't match, we don't
176-
// need to check any further.
177-
if (FD->getDeclContext() != Overload->getDeclContext())
178-
return false;
179-
180-
// Since the declaration contexts match, see whether
181-
// the current element is the corresponding operator.
182-
if (!areCorrespondingOverloads(Overload, FD))
183-
return false;
184-
185-
return true;
186-
});
171+
llvm::find_if(RP.second, [&Overload](const FunctionDecl *FD) {
172+
if (FD == Overload)
173+
return false;
174+
// If the declaration contexts don't match, we don't
175+
// need to check any further.
176+
if (FD->getDeclContext() != Overload->getDeclContext())
177+
return false;
178+
179+
// Since the declaration contexts match, see whether
180+
// the current element is the corresponding operator.
181+
if (!areCorrespondingOverloads(Overload, FD))
182+
return false;
183+
184+
return true;
185+
});
187186

188187
if (Match == RP.second.end()) {
189188
// Check to see if there is a corresponding overload in a base class

clang-tools-extra/clangd/refactor/Rename.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,8 @@ void filterRenameTargets(llvm::DenseSet<const NamedDecl *> &Decls) {
185185
// For renaming, we're only interested in foo's declaration, so drop the other
186186
// one. There should never be more than one UsingDecl here, otherwise the
187187
// rename would be ambiguos anyway.
188-
auto UD = std::find_if(Decls.begin(), Decls.end(), [](const NamedDecl *D) {
189-
return llvm::isa<UsingDecl>(D);
190-
});
188+
auto UD = llvm::find_if(
189+
Decls, [](const NamedDecl *D) { return llvm::isa<UsingDecl>(D); });
191190
if (UD != Decls.end()) {
192191
Decls.erase(UD);
193192
}

0 commit comments

Comments
 (0)