[clang-tools-extra] d71adeb - [include-cleaner] Map the 4-argument move overload to the algorithm header.

Viktoriia Bakalova via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 04:39:21 PDT 2023


Author: Viktoriia Bakalova
Date: 2023-09-06T11:38:56Z
New Revision: d71adebb9fb875a5fd23acdbe0cf0799092fa4ca

URL: https://github.com/llvm/llvm-project/commit/d71adebb9fb875a5fd23acdbe0cf0799092fa4ca
DIFF: https://github.com/llvm/llvm-project/commit/d71adebb9fb875a5fd23acdbe0cf0799092fa4ca.diff

LOG: [include-cleaner] Map the 4-argument move overload to the algorithm header.

Differential Revision: https://reviews.llvm.org/D159463

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
    clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp b/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
index f9438a2c8c49e48..f46dae3b3d50cbb 100644
--- a/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
+++ b/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
@@ -125,8 +125,10 @@ headerForAmbiguousStdSymbol(const NamedDecl *ND) {
     if (FD->getNumParams() == 1)
       // move(T&& t)
       return tooling::stdlib::Header::named("<utility>");
-    if (FD->getNumParams() == 3)
+    if (FD->getNumParams() == 3 || FD->getNumParams() == 4)
       // move(InputIt first, InputIt last, OutputIt dest);
+      // move(ExecutionPolicy&& policy, ForwardIt1 first,
+      // ForwardIt1 last, ForwardIt2 d_first);
       return tooling::stdlib::Header::named("<algorithm>");
   } else if (FName == "remove") {
     if (FD->getNumParams() == 1)

diff  --git a/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp b/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
index be97eb13a704eef..b8f30c25e5c11b2 100644
--- a/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp
@@ -546,6 +546,16 @@ TEST_F(HeadersForSymbolTest, AmbiguousStdSymbols) {
           "move",
           "<algorithm>",
       },
+      {
+          R"cpp(
+            namespace std {
+             template<class ExecutionPolicy, class ForwardIt1, class ForwardIt2>
+             ForwardIt2 move(ExecutionPolicy&& policy,
+                 ForwardIt1 first, ForwardIt1 last, ForwardIt2 d_first);
+            })cpp",
+          "move",
+          "<algorithm>",
+      },
       {
           R"cpp(
             namespace std {


        


More information about the cfe-commits mailing list