From: Haojian Wu Date: Mon, 5 Nov 2018 15:08:00 +0000 (+0000) Subject: [Tooling] Correct the total number of files being processed when `filter` is provided. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=320f5ff310cb99e06ab959f02076dd7d0d838cac;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346135 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Tooling/AllTUsExecution.cpp b/lib/Tooling/AllTUsExecution.cpp index 5da21e03bc..0f172b7829 100644 --- a/lib/Tooling/AllTUsExecution.cpp +++ b/lib/Tooling/AllTUsExecution.cpp @@ -96,7 +96,12 @@ llvm::Error AllTUsToolExecutor::execute( llvm::errs() << Msg.str() << "\n"; }; - auto Files = Compilations.getAllFiles(); + std::vector 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 +