[clang] Add -Wsuggest-override
authorLogan Smith <logan.r.smith0@gmail.com>
Sun, 12 Jul 2020 22:38:37 +0000 (15:38 -0700)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 12 Jul 2020 23:05:24 +0000 (16:05 -0700)
commit111167895d47558989f9f3a593a82527b016c7e7
tree47314508c63b393dbf473b9cb87b1f32874872d5
parentc73f425f84ad18e4b610dff7d21a5844fb0da5d7
[clang] Add -Wsuggest-override

This patch adds `-Wsuggest-override`, which allows for more aggressive enforcement of modern C++ best practices, as well as better compatibility with gcc, which has had its own `-Wsuggest-override` since version 5.1.

Clang already has `-Winconsistent-missing-override`, which only warns in the case where there is at least one function already marked `override` in a class. This warning strengthens that warning by suggesting the `override` keyword regardless of whether it is already present anywhere.

The text between suggest-override and inconsistent-missing-override is now shared, using `TextSubstitution` for the entire diagnostic text.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D82728
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/warn-suggest-destructor-override [new file with mode: 0644]
clang/test/SemaCXX/warn-suggest-override [new file with mode: 0644]