[PATCH] D54104: [Tooling] Correct the total number of files being processed when `filter` is provided.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 5 07:09:32 PST 2018


hokein updated this revision to Diff 172585.
hokein marked 2 inline comments as done.
hokein added a comment.

Address comments.


Repository:
  rC Clang

https://reviews.llvm.org/D54104

Files:
  lib/Tooling/AllTUsExecution.cpp


Index: lib/Tooling/AllTUsExecution.cpp
===================================================================
--- lib/Tooling/AllTUsExecution.cpp
+++ lib/Tooling/AllTUsExecution.cpp
@@ -96,7 +96,12 @@
     llvm::errs() << Msg.str() << "\n";
   };
 
-  auto Files = Compilations.getAllFiles();
+  std::vector<std::string> Files;
+  llvm::Regex RegexFilter(Filter);
+  for (const auto& File : Compilations.getAllFiles()) {
+    if (RegexFilter.match(File))
+      Files.push_back(File);
+  }
   // Add a counter to track the progress.
   const std::string TotalNumStr = std::to_string(Files.size());
   unsigned Counter = 0;
@@ -116,10 +121,7 @@
       llvm::errs() << "Error while getting current working directory: "
                    << EC.message() << "\n";
     }
-    llvm::Regex RegexFilter(Filter);
     for (std::string File : Files) {
-      if (!RegexFilter.match(File))
-        continue;
       Pool.async(
           [&](std::string Path) {
             Log("[" + std::to_string(Count()) + "/" + TotalNumStr +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54104.172585.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181105/74e5008a/attachment-0001.bin>


More information about the cfe-commits mailing list