[PATCH] Change the behavior of clang-tidy -checks=, remove -disable-checks.

Alexander Kornienko alexfh at google.com
Thu May 15 01:09:33 PDT 2014


On 15 May 2014 10:03, "Manuel Klimek" <klimek at google.com> wrote:
>
> After thinking a bit about this, I'd like to revisit this from scratch
(as it has changed quite a bit).
>
> Why is: -check=<regexp> not enough? Give it a good enough default value
(that is printed if you say -help), and we have the following use cases:
> - add something to the default set: clang-tidy -help, copy default set,
add own

This is already problematic: making the user copy default value and adjust
it is inconvenient. Also, how do you exclude something? Say, you run
clang-tidy and see a number of results from checks you don't care about.
How do you exclude them?

> - run only a single check: -check=my-full.check
> - run only google checks: -check=google-.*
>
>
>
>
>
> On Wed, May 14, 2014 at 10:13 PM, Alexander Kornienko <alexfh at google.com>
wrote:
>>
>> Hi klimek,
>>
>> Make checks filtering more intuitive and easy to use. Remove
>> -disable-checks and change the format of -checks= to a comma-separated
list of
>> globs with optional '-' prefix to denote exclusion. The -checks= option
is now
>> cumulative, so it modifies defaults, not overrides them. Each glob adds
or
>> removes to the current set of checks, so the filter can be refined or
overriden
>> by adding globs.
>>
>> Example:
>>   The default value for -checks= is
>>
'*,-clang-analyzer-alpha*,-llvm-include-order,-llvm-namespace-comment,-google-*',
>>   which allows all checks except for the ones named
clang-analyzer-alpha* and
>>   others specified with the leading '-'. To allow all google-* checks
one can
>>   write:
>>     clang-tidy -checks=google-* ...
>>   If one needs only google-* checks, we first need to remove everything
(-*):
>>     clang-tidy -checks=-*,google-*
>>   etc.
>>
>> I'm not sure if we need to change something here, so I didn't touch the
docs
>> yet.
>>
>> http://reviews.llvm.org/D3770
>>
>> Files:
>>   clang-tidy/ClangTidyDiagnosticConsumer.cpp
>>   clang-tidy/ClangTidyDiagnosticConsumer.h
>>   clang-tidy/ClangTidyOptions.h
>>   clang-tidy/tool/ClangTidyMain.cpp
>>   test/clang-tidy/arg-comments.cpp
>>   test/clang-tidy/basic.cpp
>>   test/clang-tidy/check_clang_tidy_fix.sh
>>   test/clang-tidy/check_clang_tidy_output.sh
>>   test/clang-tidy/deduplication.cpp
>>   test/clang-tidy/diagnostic.cpp
>>   test/clang-tidy/file-filter.cpp
>>   test/clang-tidy/fix.cpp
>>   test/clang-tidy/macros.cpp
>>   test/clang-tidy/nolint.cpp
>>   test/clang-tidy/select-checks.cpp
>>   test/clang-tidy/static-analyzer.cpp
>>   test/clang-tidy/temporaries.cpp
>>   unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140515/1cd5d8fe/attachment.html>


More information about the cfe-commits mailing list