[cfe-dev] Tidy vs Warnings: missing override

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 13 08:44:09 PDT 2018


On Mon, Aug 13, 2018 at 12:00 AM Matthieu Brucher via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I think that the override is not an after-the-bug tool, but really a
> proactive checker.
>

Right - and this is why it's probably not suitable as a warning, and better
suited to being in clang-tidy.


> It doesn't tell you of a bug, it prevents you for introducing one.
> On an old code base, that's where I find it the most helpful, when you
> have to work on it. Without the override, you don't have the certainty of
> properly updating the APIs (old code base also often miss proper test
> coverage). With override, before your code changes, you can ensure that you
> are refactoring the full API.
>
> Cheers,
>
> Matthieu
>
> Le lun. 13 août 2018 à 01:59, David Blaikie <dblaikie at gmail.com> a écrit :
>
>> When I say a "false positive" in this context it's not a case where a
>> warning would suggest override where it would be invalid/incorrect to put
>> ovterride - but that it would suggest the 'override' keyword when it would
>> be benign/when it isn't telling the user there's a bug/mistake here.
>>
>> On an old codebase, likely /many/ more missing overrides are there
>> because there was no override keyword when the code was written - most of
>> those missing overrides aren't buggy code. So this warning would cause a
>> lot of cleanup for relatively little bug finding.
>>
>> - Dave
>>
>> On Fri, Aug 10, 2018 at 8:36 AM Matthieu Brucher via cfe-dev <
>> cfe-dev at lists.llvm.org> wrote:
>>
>>> Yes, I have to write an example case!
>>> I think the odds of an error with a wrong override are very low. Ont he
>>> contrary, I noticed several times errors with missing overrides and APIs
>>> moving and wrong arguments.
>>>
>>> Cheers
>>>
>>> Le ven. 10 août 2018 à 15:41, Jonas Toth <development at jonas-toth.eu> a
>>> écrit :
>>>
>>>> That would be worth a bug-report :)
>>>>
>>>> Am 10.08.2018 um 15:03 schrieb Matthieu Brucher:
>>>>
>>>> Hi,
>>>>
>>>> I have noticed the missing override warning when using virtual diamond
>>>> inheritance. In that case, there was no warning generated.
>>>>
>>>> Regards,
>>>>
>>>> Matthieu
>>>>
>>>> Le ven. 10 août 2018 à 10:23, Jonas Toth via cfe-dev <
>>>> cfe-dev at lists.llvm.org> a écrit :
>>>>
>>>>> Hi,
>>>>>
>>>>> I experience the override-warning when it was inconsistent within the
>>>>> class (meaning it has been used at least once and some places missed it).
>>>>> This measure is probably to not warn on old code bases.
>>>>>
>>>>> Could this be the case?
>>>>>
>>>>> Best, Jonas
>>>>>
>>>>> Am 09.08.2018 um 19:26 schrieb JVApen via cfe-dev:
>>>>>
>>>>> Hello all,
>>>>>
>>>>> Today we have discovered a case where we did not have a compiler
>>>>> warning for a missing override. To verify, we explicitly enabled the
>>>>> warning with the pragma.
>>>>>
>>>>> While investigating this in the IDE, we noticed that the Visual Assist
>>>>> plugin did notice that missing override. As this uses clang-tidy to
>>>>> determine this, we were wondering if these differences we noticed are
>>>>> intentional. If so, is their any documentation on these differences?
>>>>>
>>>>> Tnx
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-dev mailing listcfe-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-dev mailing list
>>>>> cfe-dev at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>
>>>>
>>>>
>>>> --
>>>> Quantitative analyst, Ph.D.
>>>> Blog: http://blog.audio-tk.com/
>>>> LinkedIn: http://www.linkedin.com/in/matthieubrucher
>>>>
>>>>
>>>>
>>>
>>> --
>>> Quantitative analyst, Ph.D.
>>> Blog: http://blog.audio-tk.com/
>>> LinkedIn: http://www.linkedin.com/in/matthieubrucher
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>
>>
>
> --
> Quantitative analyst, Ph.D.
> Blog: http://blog.audio-tk.com/
> LinkedIn: http://www.linkedin.com/in/matthieubrucher
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180813/dc28cbb5/attachment.html>


More information about the cfe-dev mailing list