[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 06:52:46 PST 2018


hokein created this revision.
hokein added a reviewer: ioeric.

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,13 @@
     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))
+      continue;
+    Files.push_back(File);
+  }
   // Add a counter to track the progress.
   const std::string TotalNumStr = std::to_string(Files.size());
   unsigned Counter = 0;
@@ -118,8 +124,6 @@
     }
     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.172582.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181105/c3df4290/attachment.bin>


More information about the cfe-commits mailing list