[PATCH] D40671: [clang-tidy] Support specific checks for NOLINT directive
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 15 07:56:51 PST 2017
alexfh added a comment.
In https://reviews.llvm.org/D40671#954906, @xgsa wrote:
> In https://reviews.llvm.org/D40671#954661, @alexfh wrote:
> > In https://reviews.llvm.org/D40671#953888, @aaron.ballman wrote:
> > > FWIW, I think we should do something about unknown check names in NOLINT comments, but that can be done as a follow-up patch. If we're ignoring the comment, we might want to diagnose that fact so users have an idea what's going on.
> > IIUC, cpplint can output a diagnostic about unknown categories inside NOLINT and about NOLINT directives that happen on lines where no warning is emitted. Both would be useful in clang-tidy, IMO.
> I agree with your statements and I think there should be the following diagnostics about NOLINT usage:
> - as you described, using of NOLINT with unknown check names;
> - using of NOLINT for the line, on which there is no diagnostics (at all with NOLINT and for the swpecified diagnostics); this should help to detect dangling NOLINT comments, that have no meaning anymore.
> Moreover, there should be a way to turn on/off these diagnostics, so possibily they should be a separate checks. What do you think? Is there a way for a check to collect the emitted diagnostics?
The existing clang-tidy infrastructure for checks doesn't provide a way for checks to interact or to collect other checks' diagnostics, and I'm not sure this functionality would be helpful beyond this specific feature. So all of this seems more reasonable to implement as a part of clang-tidy itself.
More information about the cfe-commits