[clang-tools-extra] [clang-tidy][docs] Clarify virtual-class-destructor covers only C.35 rule 1 (PR #214659)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 02:10:09 PDT 2026
https://github.com/richardmilles updated https://github.com/llvm/llvm-project/pull/214659
>From 4596cdfc507d8fb4b152a4f08f6d8079b37ca104 Mon Sep 17 00:00:00 2001
From: richardmilles <darkenhalneke at gmail.com>
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
Fixes #186628
Co-authored-by: Cursor <cursoragent at cursor.com>
---
.../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++
More information about the cfe-commits
mailing list