[PATCH] D54092: [Tooling] Add "-filter" option to AllTUsExecution
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 5 05:01:24 PST 2018
ioeric accepted this revision.
ioeric added inline comments.
This revision is now accepted and ready to land.
================
Comment at: lib/Tooling/AllTUsExecution.cpp:120
for (std::string File : Files) {
+ if (Filter.getNumOccurrences() != 0 && !RegexFilter.match(File))
+ continue;
----------------
hokein wrote:
> ioeric wrote:
> > hokein wrote:
> > > ioeric wrote:
> > > > > `Filter.getNumOccurrences() != 0 `
> > > > Would this work if `Filter` is set grammatically? Although it's not exposed now, it might make more sense to check `Filter != ".*"`.
> > > Yes, getNumOccurrences returns non-zero only when the flag is set by the command line.
> > >
> > > ```
> > > clang-tool -executor=all-TUs . # => getNumOccurrences() == 0
> > > clang-tool -executor=all-TUs -filter="xx" . # > getNumOccurrences() != 0
> > > ```
> > Sorry, I meant "programmatically"... something like `Filter.setInitialValue("...")`.
> hmm, it works the same as `llvm::cl::init` (`getNumOccurrences` returns 0).
>
> I removed this check (just use `if (!Filter.match)`), the reason I added here is to avoid the cost of regex match, but it seems pre-optimization.
sounds good.
Repository:
rC Clang
https://reviews.llvm.org/D54092
More information about the cfe-commits
mailing list