[PATCH] D110614: [clang-tidy] Fix false positives in cppcoreguidelines-virtual-class-destructor

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 30 01:18:48 PDT 2021


carlosgalvezp added a comment.

Ahh, it seems that for templates, the class has this AST:

  |-ClassTemplateDecl <line:6:1, line:10:1> line:7:8 Derived
  | |-TemplateTypeParmDecl <line:6:11, col:20> col:20 typename depth 0 index 0 T
  | |-CXXRecordDecl <line:7:1, line:10:1> line:7:8 struct Derived definition
  | `-ClassTemplateSpecializationDecl <line:6:1, line:10:1> line:7:8 struct Derived definition

So the derived destructor only shows up in `ClassTemplateSpecializationDecl` - the `CXXRecordDecl` doesn't have it (therefore implicit public non-virtual) and that's why the check triggers.


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

https://reviews.llvm.org/D110614



More information about the cfe-commits mailing list