I wanted to gauge interest in a patch that would allow clang-tidy’s -header-filter option to accept std::regex expressions instead of its current support of only the llvm::Regex. I’ve been using this in a local build of clang-tidy recently and have a patch ready to submit if people are interested.
Pros:
This would allow negative lookahead in -header-filter regular expressions (something llvm::Regex doesn’t support). For example, I’ve been working in a large repository with lots of subdirs/submodules, including a ThirdPartyLibs subdir where we check in SHAs of all third party, open source code we are using. It’s nice to be able to pass the negative lookahead regex:
^(?!.ThirdPartyLibs.).*$
and filter out all third party headers when running clang-tidy.
Other command line options (files, -checks, maybe others) accept glob filters, which allow for negation, and this comes in handy. I think we should be consistent in allowing negation of some form in all filter options. I can try to re-implement this with a glob filter if that’s preferable.
Cons:
Some compilers may not support std::regex. I’m not sure when that was introduced in various compilers, or if clang still supports building on those compilers. Any other drawbacks I’m not thinking off?
I asked about something similar to this a couple of months ago. I believe that the response was that one of the supported compilers did not currently have std::regex.
I believe that the timeframe was that after the 3.8 release the transition to using std::regex would be feasible.
[Please reply *only* to the list and do not include my email directly
in the To: or Cc: of your reply; otherwise I will not see your reply.
Thanks.]
In article <CANgHf=wWbzxTCCK91cP0hOVE-2zOiLRLgOODO-yekHBngCLuJw@mail.gmail.com>,
Daniel Dilts via cfe-dev <cfe-dev@lists.llvm.org> writes:
I asked about something similar to this a couple of months ago. I believe
that the response was that one of the supported compilers did not currently
have std::regex.
If we can't move forward due to lack of std::regex support, I'd like
to see glob based filtering with positive and negative filtering like
we have for checks.
[Please reply *only* to the list and do not include my email directly
in the To: or Cc: of your reply; otherwise I will not see your reply.
Thanks.]
In article <CANgHf=
wWbzxTCCK91cP0hOVE-2zOiLRLgOODO-yekHBngCLuJw@mail.gmail.com>,
Daniel Dilts via cfe-dev <cfe-dev@lists.llvm.org> writes:
> I asked about something similar to this a couple of months ago. I
believe
> that the response was that one of the supported compilers did not
currently
> have std::regex.
If we can't move forward due to lack of std::regex support, I'd like
to see glob based filtering with positive and negative filtering like
we have for checks.
Might be a good idea also for consistency with check filtering. If someone
interested sends me a patch, I'm happy to review it