https://github.com/richardmilles created https://github.com/llvm/llvm-project/pull/214659
## Summary - The documentation for `cppcoreguidelines-virtual-class-destructor` claimed the check implements C.35 in full. - It only enforces the first C.35 rule (classes with virtual functions must have a public virtual or protected non-virtual destructor). - Clarify that the second C.35 rule (base classes of publicly derived classes) is not currently enforced. Fixes #186628 ## Test plan - [ ] Docs-only change; no functional tests required - [ ] Review rendered wording against C.35 enforcement rules Assisted-by: Cursor Made with [Cursor](https://cursor.com) >From 3c5ab1d854a2f17ab91cfacd6cde4731df8add94 Mon Sep 17 00:00:00 2001 From: richardmilles <[email protected]> Date: Fri, 7 Aug 2026 10:17:06 +0200 Subject: [PATCH] [clang-tidy][docs] Clarify cppcoreguidelines-virtual-class-destructor covers only C.35 rule 1 The docs claimed full C.35 coverage, but the check only enforces the first rule (classes with virtual functions). Document that the second rule is not implemented yet. Fixes #186628 Assisted-by: Cursor Co-authored-by: Cursor <[email protected]> --- .../cppcoreguidelines/virtual-class-destructor.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/virtual-class-destructor.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/virtual-class-destructor.rst index 80932c416fe01..4781a3c6e937a 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/virtual-class-destructor.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/virtual-class-destructor.rst @@ -7,9 +7,13 @@ Finds virtual classes whose destructor is neither public and virtual nor protected and non-virtual. A virtual class's destructor should be specified in one of these ways to prevent undefined behavior. -This check implements +This check implements the first enforcement rule of `C.35 <http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#rc-dtor-virtual>`_ -from the C++ Core Guidelines. +from the C++ Core Guidelines: a class with any virtual functions should have a +destructor that is either public and virtual or else protected and non-virtual. + +It does not currently enforce the second rule of C.35, which requires that a +base class of a publicly derived class also have such a destructor. Note that this check will diagnose a class with a virtual method regardless of whether the class is used as a base class or not. @@ -24,7 +28,7 @@ Example ------- For example, the following classes/structs get flagged by the check since they -violate guideline **C.35**: +violate the first enforcement rule of **C.35**: .. code-block:: c++ _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
