[PATCH] D126891: [clang-tidy] The check should ignore final classes

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 01:15:27 PDT 2022


carlosgalvezp added a comment.

In D126891#3555456 <https://reviews.llvm.org/D126891#3555456>, @steakhal wrote:

> In D126891#3554039 <https://reviews.llvm.org/D126891#3554039>, @carlosgalvezp wrote:
>
>> Hmm, `MostDerived` **does** have a public virtual destructor in your example already - if the base class destructor is virtual, the child class destructor is virtual. In that sense the check should not warn.
>>
>> Seems like there's some deeper problem in the check?
>
> Not quite. None of the destructors are virtual in the example. In fact, the `MostDerived` has a //public// and //non-virtual// destructor.

Doesn't `Base` have a virtual destructor? As per the standard <https://timsong-cpp.github.io/cppwp/n4140/class.dtor#9>:

> If a class has a base class with a virtual destructor, its destructor (whether user- or implicitly-declared) is virtual.

To clarify: I'm not opposed to the patch, I'm just trying to understand if the AST is indeed implementing the Standard correctly and classifying the `Derived` destructor as virtual.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126891/new/

https://reviews.llvm.org/D126891



More information about the cfe-commits mailing list