hokein updated this revision to Diff 172571.
hokein added a comment.

Remove the default value check.


Repository:
  rC Clang

https://reviews.llvm.org/D54092

Files:
  lib/Tooling/AllTUsExecution.cpp


Index: lib/Tooling/AllTUsExecution.cpp
===================================================================
--- lib/Tooling/AllTUsExecution.cpp
+++ lib/Tooling/AllTUsExecution.cpp
@@ -53,6 +53,12 @@
 
 } // namespace
 
+static llvm::cl::opt<std::string> Filter(
+    "filter",
+    llvm::cl::desc("Only process files that match this filter. "
+                   "This flag only applies to all-TUs."),
+    llvm::cl::init(".*"));
+
 AllTUsToolExecutor::AllTUsToolExecutor(
     const CompilationDatabase &Compilations, unsigned ThreadCount,
     std::shared_ptr<PCHContainerOperations> PCHContainerOps)
@@ -110,7 +116,10 @@
       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 +
@@ -147,7 +156,8 @@
 static llvm::cl::opt<unsigned> ExecutorConcurrency(
     "execute-concurrency",
     llvm::cl::desc("The number of threads used to process all files in "
-                   "parallel. Set to 0 for hardware concurrency."),
+                   "parallel. Set to 0 for hardware concurrency. "
+                   "This flag only applies to all-TUs."),
     llvm::cl::init(0));
 
 class AllTUsToolExecutorPlugin : public ToolExecutorPlugin {


Index: lib/Tooling/AllTUsExecution.cpp
===================================================================
--- lib/Tooling/AllTUsExecution.cpp
+++ lib/Tooling/AllTUsExecution.cpp
@@ -53,6 +53,12 @@
 
 } // namespace
 
+static llvm::cl::opt<std::string> Filter(
+    "filter",
+    llvm::cl::desc("Only process files that match this filter. "
+                   "This flag only applies to all-TUs."),
+    llvm::cl::init(".*"));
+
 AllTUsToolExecutor::AllTUsToolExecutor(
     const CompilationDatabase &Compilations, unsigned ThreadCount,
     std::shared_ptr<PCHContainerOperations> PCHContainerOps)
@@ -110,7 +116,10 @@
       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 +
@@ -147,7 +156,8 @@
 static llvm::cl::opt<unsigned> ExecutorConcurrency(
     "execute-concurrency",
     llvm::cl::desc("The number of threads used to process all files in "
-                   "parallel. Set to 0 for hardware concurrency."),
+                   "parallel. Set to 0 for hardware concurrency. "
+                   "This flag only applies to all-TUs."),
     llvm::cl::init(0));
 
 class AllTUsToolExecutorPlugin : public ToolExecutorPlugin {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to