[PATCH] D82728: [clang] Add -Wsuggest-override

Logan Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 7 17:43:31 PDT 2020


logan-5 marked an inline comment as done.
logan-5 added inline comments.


================
Comment at: clang/test/SemaCXX/warn-suggest-destructor-override:1
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -Wsuggest-destructor-override
+
----------------
logan-5 wrote:
> dblaikie wrote:
> > Does GCC have suggest-destructor-override as a separate warning too?
> It does not. In fact, there's no way to get GCC to warn about destructors missing `override`. (Which is somewhat defensible, since `override` is really great for preventing subtle signature mismatches/typos, but destructors don't really have those problems.) However, Clang already has a destructor-specific flavor of the inconsistent-override warning, so I added -Wsuggest-destructor-override for symmetry with -Winconsistent-missing-[destructor-]override.
Note that this really is the best of both worlds, since it lets Clang's -Wsuggest-override behave identically to GCC's (not warning on destructors), as well as be consistent with its own already existing override warnings (with a special extra flag to enable warnings for destructors).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82728/new/

https://reviews.llvm.org/D82728





More information about the cfe-commits mailing list