Skip to content

Commit 964841d

Browse files
committed
Add unnecessary-virtual-specifier to -Wextra
1 parent c956ed0 commit 964841d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

+4-4
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,12 @@ def CXX11WarnSuggestOverride : DiagGroup<"suggest-override">;
421421
def WarnUnnecessaryVirtualSpecifier : DiagGroup<"unnecessary-virtual-specifier"> {
422422
code Documentation = [{
423423
Warns when a ``final`` class contains a virtual method (including virtual
424-
destructors). Since ``final`` classes cannot be subclassed, their methods
425-
cannot be overridden, and hence the ``virtual`` specifier is useless.
424+
destructors) that does not override anything. Since ``final`` classes cannot
425+
be subclassed, their methods cannot be overridden, so there is no point to
426+
introducing new ``virtual`` methods.
426427

427428
The warning also detects virtual methods in classes whose destructor is
428429
``final``, for the same reason.
429-
430-
The warning does not fire on virtual methods which are also marked ``override``.
431430
}];
432431
}
433432

@@ -1163,6 +1162,7 @@ def Extra : DiagGroup<"extra", [
11631162
FUseLdPath,
11641163
CastFunctionTypeMismatch,
11651164
InitStringTooLongMissingNonString,
1165+
WarnUnnecessaryVirtualSpecifier,
11661166
]>;
11671167

11681168
def Most : DiagGroup<"most", [

0 commit comments

Comments
 (0)