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

Haojian Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 5 07:10:42 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL346135: [Tooling] Correct the total number of files being processed when `filter` is… (authored by hokein, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D54104

Files:
  cfe/trunk/lib/Tooling/AllTUsExecution.cpp


Index: cfe/trunk/lib/Tooling/AllTUsExecution.cpp
===================================================================
--- cfe/trunk/lib/Tooling/AllTUsExecution.cpp
+++ cfe/trunk/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.172586.patch
Type: text/x-patch
Size: 1051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181105/d9206c39/attachment.bin>


More information about the llvm-commits mailing list