[clang-tools-extra] Use llvm::find_if (NFC) (#140411)
This commit is contained in:
parent
bc6107a8d2
commit
1a40edf2c0
@ -168,22 +168,21 @@ void NewDeleteOverloadsCheck::onEndOfTranslationUnit() {
|
|||||||
// complexity when searching for corresponding free store functions.
|
// complexity when searching for corresponding free store functions.
|
||||||
for (const auto *Overload : RP.second) {
|
for (const auto *Overload : RP.second) {
|
||||||
const auto *Match =
|
const auto *Match =
|
||||||
std::find_if(RP.second.begin(), RP.second.end(),
|
llvm::find_if(RP.second, [&Overload](const FunctionDecl *FD) {
|
||||||
[&Overload](const FunctionDecl *FD) {
|
if (FD == Overload)
|
||||||
if (FD == Overload)
|
return false;
|
||||||
return false;
|
// If the declaration contexts don't match, we don't
|
||||||
// If the declaration contexts don't match, we don't
|
// need to check any further.
|
||||||
// need to check any further.
|
if (FD->getDeclContext() != Overload->getDeclContext())
|
||||||
if (FD->getDeclContext() != Overload->getDeclContext())
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
// Since the declaration contexts match, see whether
|
// Since the declaration contexts match, see whether
|
||||||
// the current element is the corresponding operator.
|
// the current element is the corresponding operator.
|
||||||
if (!areCorrespondingOverloads(Overload, FD))
|
if (!areCorrespondingOverloads(Overload, FD))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Match == RP.second.end()) {
|
if (Match == RP.second.end()) {
|
||||||
// Check to see if there is a corresponding overload in a base class
|
// Check to see if there is a corresponding overload in a base class
|
||||||
|
@ -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
|
// 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
|
// one. There should never be more than one UsingDecl here, otherwise the
|
||||||
// rename would be ambiguos anyway.
|
// rename would be ambiguos anyway.
|
||||||
auto UD = std::find_if(Decls.begin(), Decls.end(), [](const NamedDecl *D) {
|
auto UD = llvm::find_if(
|
||||||
return llvm::isa<UsingDecl>(D);
|
Decls, [](const NamedDecl *D) { return llvm::isa<UsingDecl>(D); });
|
||||||
});
|
|
||||||
if (UD != Decls.end()) {
|
if (UD != Decls.end()) {
|
||||||
Decls.erase(UD);
|
Decls.erase(UD);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user