[clang-tools-extra] r249399 - Add a new module for the C++ Core Guidelines, and the first checker for those guidelines: cppcoreguidelines-pro-type-reinterpret-cast.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 10:34:37 PDT 2015


On Wed, Oct 7, 2015 at 12:05 PM, Joerg Sonnenberger via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> On Tue, Oct 06, 2015 at 01:31:01PM -0000, Aaron Ballman via cfe-commits wrote:
>> Log:
>> Add a new module for the C++ Core Guidelines, and the first checker
>> for those guidelines: cppcoreguidelines-pro-type-reinterpret-cast.
>
> I wonder about the generality of this. Does it really make sense to flag
> every reinterpret_cast of a void pointer? Such interface contracts
> normally don't give you an alternative, so it seems a bit silly. This is
> made worse by the concrete message used...
>
> More importantly, can the checker detect all cases where
> reinterpret_cast is used where a less generic cast applies?

This is a checker specific to the behaviors of the C++ Core
Guidelines. Personally, I share the same concerns about the viability
of these kind of checks (specifically, on existing code bases instead
of on newly-developed code). Especially when there's no guidance as to
how to correct the code, short of "just don't do that thing despite it
being well-formed code." However, the concept here is that we want
checkers to diagnose coding guideline violations as-written, and that
is why these checkers are being implemented under cppcoreguidelines-*.

~Aaron

>
> Joerg
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list