[cfe-dev] clang-tidy Negative Lookahead Support

Daniel Dilts via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 20 13:06:07 PST 2015


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.

Can anyone confirm this?

On Fri, Nov 20, 2015 at 11:41 AM, Samuel Baxter via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi all,
>
> 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?
>
> Let me know what you all think!
> - Sam Baxter
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151120/51599a08/attachment.html>


More information about the cfe-dev mailing list