r346135 - [Tooling] Correct the total number of files being processed when `filter` is provided.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 5 07:08:00 PST 2018
Author: hokein
Date: Mon Nov 5 07:08:00 2018
New Revision: 346135
URL: http://llvm.org/viewvc/llvm-project?rev=346135&view=rev
Log:
[Tooling] Correct the total number of files being processed when `filter` is provided.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54104
Modified:
cfe/trunk/lib/Tooling/AllTUsExecution.cpp
Modified: cfe/trunk/lib/Tooling/AllTUsExecution.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/AllTUsExecution.cpp?rev=346135&r1=346134&r2=346135&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/AllTUsExecution.cpp (original)
+++ cfe/trunk/lib/Tooling/AllTUsExecution.cpp Mon Nov 5 07:08:00 2018
@@ -96,7 +96,12 @@ llvm::Error AllTUsToolExecutor::execute(
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::Error AllTUsToolExecutor::execute(
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 +
More information about the cfe-commits
mailing list