[all-commits] [llvm/llvm-project] d9afb8: [clang-tidy] cppcoreguidelines-virtual-class-destr...
Balazs Benics via All-commits
all-commits at lists.llvm.org
Tue Jun 21 02:05:59 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d9afb8c3e8fd01a3c89ab2ddebcd44602a30a975
https://github.com/llvm/llvm-project/commit/d9afb8c3e8fd01a3c89ab2ddebcd44602a30a975
Author: Balazs Benics <balazs.benics at sigmatechnology.se>
Date: 2022-06-21 (Tue, 21 Jun 2022)
Changed paths:
M clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
M clang-tools-extra/docs/ReleaseNotes.rst
M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-virtual-class-destructor.cpp
Log Message:
-----------
[clang-tidy] cppcoreguidelines-virtual-class-destructor should ignore final classes
The `cppcoreguidelines-virtual-class-destructor` supposed to enforce
http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-non-virtual
Quote:
> A **base** class destructor should be either public and virtual, or
> protected and non-virtual
[emphasis mine]
However, this check still rules the following case:
class MostDerived final : public Base {
public:
MostDerived() = default;
~MostDerived() = default;
void func() final;
};
Even though `MostDerived` class is marked `final`, thus it should not be
considered as a **base** class. Consequently, the rule is satisfied, yet
the check still flags this code.
In this patch, I'm proposing to ignore `final` classes since they cannot
be //base// classes.
Reviewed By: whisperity
Differential Revision: https://reviews.llvm.org/D126891
More information about the All-commits
mailing list