This is a proof-of-concept how the [[clang::suppress(tags,...)]] attribute can
work with suppressing clang-tidy warnings.
The list of tags that can be used to suppress a specific warnings comes
from [1]. It is the group that the cppcoreguidelines check belongs to
("type"), the name of the check there ("type.1") and the clang-tidy
name ("cppcoreguidelines-pro-type-reinterpret-cast").
I envision to put this into all cppcoreguidelines checks. Alternatively,
this could go into clang-tidy core, to have this automatically for all
checks.
I'm looking forward to your comments!
Depends on: D24886
[1] https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#inforce-enforcement
Hmm, it seems like this is boilerplate we are going to want for every rule, and that it's pretty easy to not get this right (for instance, if you change the way the check is spelled, you have to remember to update this as well). Could this actually be handled more transparently, by gathering this information when the check is registered and exposing it to the check?
The checks would still need to use unless(isSuppressed(Rules)) in some form, but I am thinking that it would be more convenient if we could do: Finder->addMatcher(cxxReinterpretCastExpr(unlessSuppressed(*this)).bind("cast"), this);