[PATCH] D112765: [AST] injected-class-name is not a redecl, even in template specializations

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 28 15:57:03 PDT 2021


sammccall added a subscriber: carlosgalvezp.
sammccall added a comment.

After this patch we can revert D110614 <https://reviews.llvm.org/D110614> except for the testcases (cc @carlosgalvezp) as the old matchers should just work.



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-virtual-class-destructor.cpp:234
 // Derived from template, base has *not* virtual dtor
-// CHECK-MESSAGES: :[[@LINE+8]]:8: warning: destructor of 'DerivedFromTemplateNonVirtualBaseStruct' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]
-// CHECK-MESSAGES: :[[@LINE+7]]:8: note: make it public and virtual
----------------
These warnings that disappeared are spurious duplicates. They correspond to matching the injected-class-name of the template instantiation (in addition to the main declaration of it).
After this change we only match the main declaration, just like non-template classes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112765



More information about the cfe-commits mailing list