Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 17, 2025

@llvm/pr-subscribers-clang-tidy

@llvm/pr-subscribers-clang-tools-extra

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/140411.diff

2 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp (+15-16)
  • (modified) clang-tools-extra/clangd/refactor/Rename.cpp (+2-3)
diff --git a/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp b/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
index 32ea0c0cdf48c..40808aaf7c3da 100644
--- a/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
@@ -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
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index e464f1ad45c52..d9b73b83e902a 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -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);
   }

@llvmbot
Copy link
Member

llvmbot commented May 17, 2025

@llvm/pr-subscribers-clangd

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/140411.diff

2 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp (+15-16)
  • (modified) clang-tools-extra/clangd/refactor/Rename.cpp (+2-3)
diff --git a/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp b/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
index 32ea0c0cdf48c..40808aaf7c3da 100644
--- a/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
@@ -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
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index e464f1ad45c52..d9b73b83e902a 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -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);
   }

@kazutakahirata kazutakahirata merged commit 1a40edf into llvm:main May 18, 2025
15 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_llvm_find_if_clang_tools branch May 18, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants