This is an archive of the discontinued LLVM Phabricator instance.

Change the behavior of clang-tidy -checks=, remove -disable-checks.
ClosedPublic

Authored by alexfh on May 14 2014, 1:13 PM.

Details

Summary

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.

Diff Detail

Event Timeline

alexfh updated this revision to Diff 9399.May 14 2014, 1:13 PM
alexfh retitled this revision from to Change the behavior of clang-tidy -checks=, remove -disable-checks..
alexfh updated this object.
alexfh edited the test plan for this revision. (Show Details)
alexfh added a reviewer: klimek.
alexfh added a subscriber: Unknown Object (MLST).
klimek edited edge metadata.May 15 2014, 1:03 AM

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

  • run only a single check: -check=my-full.check
  • run only google checks: -check=google-.*
alexfh accepted this revision.May 15 2014, 7:34 AM
alexfh added a reviewer: alexfh.

Manuel tells offline that the patch is fine.

This revision is now accepted and ready to land.May 15 2014, 7:34 AM
alexfh closed this revision.May 15 2014, 7:34 AM