[cfe-dev] Add a clang-tidy check for inadvertent conversions

Andrzej Krzemienski via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 20 17:00:02 PDT 2018


2018-03-20 22:03 GMT+01:00 Richard via cfe-dev <cfe-dev at lists.llvm.org>:

> [Please reply *only* to the list and do not include my email directly
> in the To: or Cc: of your reply; otherwise I will not see your reply.
> Thanks.]
>
> In article <BN6PR13MB1569F3CBF08B69AED1DEC207E8D40 at BN6PR13MB1569.
> namprd13.prod.outlook.com>,
>     "Krzemienski, Andrzej via cfe-dev" <cfe-dev at lists.llvm.org> writes:
>
>
> > It would be too much false positives to NOLINT.
>
> It seems that you have to do the edits to add the attribute, so how is
> that different from doing the edits to add NOLINT?
>

The way I see the difference is that putting a NOLINT is an indication of
either:
1. An inaccurate check (it has false positives that I have to silence)
2. My inability to fix my code (because I am not in control of it, or
because I have no time to investigate)

Silencing the warning with a dedicated attribute is saying: the check is
accurate, my code is correct and clearly states intentions.

And there is still this other point. I only want to check for inadvertent
conversions caused by programmer forgetting to declare her constructor
explicit. I *do not want* to warn on non-explicit conversions operators:
they are never added by omission.
If I go with google-explicit-constructor I will have to NOLINT every
non-explicit conversion operator. If I go with the proposed check (which
does not check conversion operators -- only constructors) I do not have to
NOLINT any conversion operator.

Does this make sense?

Regards,
&rzej;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180321/12152d78/attachment.html>


More information about the cfe-dev mailing list