diff options
author | Haojian Wu <hokein@google.com> | 2018-11-05 13:42:05 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2018-11-05 13:42:05 +0000 |
commit | cd5e59f552e784642cc8865ee8ff16594057f3c7 (patch) | |
tree | 834925498153e3ffb3c89708655ca494dc0a7b2c /clang/lib/Tooling/AllTUsExecution.cpp | |
parent | 5904c41ed26dd1031acb0dbc991c3fd272ceb21f (diff) | |
download | bcm5719-llvm-cd5e59f552e784642cc8865ee8ff16594057f3c7.tar.gz bcm5719-llvm-cd5e59f552e784642cc8865ee8ff16594057f3c7.zip |
[Tooling] Add "-filter" option to AllTUsExecution
Summary: We can run the tools on a subset files of compilation database.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54092
llvm-svn: 346131
Diffstat (limited to 'clang/lib/Tooling/AllTUsExecution.cpp')
-rw-r--r-- | clang/lib/Tooling/AllTUsExecution.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Tooling/AllTUsExecution.cpp b/clang/lib/Tooling/AllTUsExecution.cpp index 0f56bbf13f7..5da21e03bcd 100644 --- a/clang/lib/Tooling/AllTUsExecution.cpp +++ b/clang/lib/Tooling/AllTUsExecution.cpp @@ -53,6 +53,12 @@ private: } // namespace +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::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 + @@ -147,7 +156,8 @@ llvm::Error AllTUsToolExecutor::execute( 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 { |