[PATCH] D38171: Implement clang-tidy check aliases.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 05:51:10 PDT 2017


xazax.hun added a comment.

@leanil : Could you add a test case where the warnings are explicitly disabled in the compilation command and also one where only the aliased warning is explicitly disabled?

In https://reviews.llvm.org/D38171#878814, @lebedev.ri wrote:

> I feel like the current handling of the clang-tidy check aliases needs adjusting.
>  If one enables all the checks (`Checks: '*'`), and then disables some of them
>  on check-by-check basis, if the disabled check has aliases
>  (`cppcoreguidelines-pro-type-vararg` vs `hicpp-vararg`, `hicpp-no-array-decay`
>  vs `cppcoreguidelines-pro-bounds-array-to-pointer-decay` and so on)
>  each of the aliases must be explicitly be disabled too.


That is somewhat intentional I think. Lets imagined you are interested in cppcoreguidelines but not interested in high integrity cpp. It would be great to be able to use Checks: `'cppcoreguidelines*,-hicpp*'` without having to worry about the aliases.

In https://reviews.llvm.org/D38171#878814, @lebedev.ri wrote:

> If that is intentional, perhaps there could be a config option to either disable
>  creation/registration of the check aliases altogether, or an option to threat
>  aliases as a hard link, so anything happening to any of the aliases/base check
>  would happen to all of them.


I think the source of the problems is that conceptually there are two distinct reasons to disable a check. One reason when the user is not interested in the results regardless what is the category or name of the check. In this case, all aliases should be disabled. The second is when a category of checks (e.g.: a guideline) is not applicable to the code. In this case aliases should not be disabled. So I think a global option would not solve this issue. A better solution might be a per glob notation. So `-` could mean do not disable aliases and `--` could mean disable aliases as well but that is just an example.

All in all, I think this is not related strictly to this issue and I think we should discuss this separately on the mailing list.

In https://reviews.llvm.org/D38171#878814, @lebedev.ri wrote:

> (Also, if the check has parameters, and one specifies different parameters for the base check, and the aliases, what happens?)


I think this is a very good point, this needs to be documented somewhere.


https://reviews.llvm.org/D38171





More information about the cfe-commits mailing list