[PATCH] D34654: Allow passing a regex for headers to exclude from clang-tidy

Todd Lipcon via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 17:06:39 PDT 2017


toddlipcon created this revision.
toddlipcon added a project: clang-tools-extra.
Herald added a subscriber: JDevlieghere.

This patch adds the ability to specify a regex of headers to exclude from clang-tidy diagnostics. This is the inverse of the existing header regex.

In our project we want to do something like include src/.*.h but exclude src/some-thirdparty/.*.h. Given only a positive regex configuration, we would have had to list all directories aside from 'some-thirdparty' such as src/(foo|bar|baz|...)/, which isn't practical or maintainable.

A while back there was a thread http://lists.llvm.org/pipermail/cfe-dev/2015-November/046203.html which suggested using extended regexes which offer negative lookahead assertions to achieve this, but it was rejected due to poor stdlib support. I think an "exclude" regex is also more familiar to users since it shows up commonly in tools like rsync/tar/etc.

(note: I previously posted this as https://reviews.llvm.org/D34415 but was asked to re-post it with cfe-commits as a subscriber. Sorry for the double-post)


Repository:
  rL LLVM

https://reviews.llvm.org/D34654

Files:
  clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tidy/ClangTidyOptions.cpp
  clang-tidy/ClangTidyOptions.h
  clang-tidy/tool/ClangTidyMain.cpp
  docs/clang-tidy/index.rst
  test/clang-tidy/file-filter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34654.104042.patch
Type: text/x-patch
Size: 10217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170627/638ecfb4/attachment-0001.bin>


More information about the cfe-commits mailing list