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

Krzemienski, Andrzej via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 26 05:38:30 PDT 2018


I am also trying to determine if such a contribution would be accepted into clang and clang-tidy sources. This would help me decide if it is worth to invest time in this development. I wonder how this process of commits from external parties looks like.

Regards,
Andrzej

From: Andrzej Krzemienski [mailto:akrzemi1 at gmail.com]
Sent: Monday, March 26, 2018 2:29 PM
To: Krzemienski, Andrzej <Andrzej.Krzemienski at sabre.com>
Subject: Fwd: [cfe-dev] Add a clang-tidy check for inadvertent conversions


---------- Forwarded message ----------
From: Andrzej Krzemienski <akrzemi1 at gmail.com<mailto:akrzemi1 at gmail.com>>
Date: 2018-03-21 1:00 GMT+01:00
Subject: Re: [cfe-dev] Add a clang-tidy check for inadvertent conversions
To: cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>



2018-03-20 22:03 GMT+01:00 Richard via cfe-dev <cfe-dev at lists.llvm.org<mailto: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<mailto:BN6PR13MB1569F3CBF08B69AED1DEC207E8D40 at BN6PR13MB1569.namprd13.prod.outlook.com>>,
    "Krzemienski, Andrzej via cfe-dev" <cfe-dev at lists.llvm.org<mailto: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/20180326/30e90229/attachment.html>


More information about the cfe-dev mailing list