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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 15 05:37:18 PDT 2021


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, unless @whisperity sees something else of concern.



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-virtual-class-destructor.cpp:208
+// Forward declarations
+// CHECK-MESSAGES-NOT: :[[@LINE+1]]:8: warning: destructor of 'ForwardDeclaredStruct' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]
+struct ForwardDeclaredStruct;
----------------
carlosgalvezp wrote:
> whisperity wrote:
> > What does this prefix do? (I've never seen this before! 😮)
> I got the tip from @aaron.ballman :) Most likely it's not technically needed (the tests would catch unexpected warnings) but it expresses more clearly the expectations.
It's a feature of `%check_clang_tidy` from the test file -- it explicitly checks that no such message was produced in output (otherwise, if a diagnostic was emitted, we wouldn't fail the test unless it failed one of the `CHECK` lines).


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

https://reviews.llvm.org/D110614



More information about the cfe-commits mailing list