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

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


logan-5 added a comment.

In D82728#2135149 <https://reviews.llvm.org/D82728#2135149>, @dblaikie wrote:

> Is the implementation you're proposing fairly consistent with GCC's? Run it over any big codebases to check it warns in the same places GCC does?


This patch has the same behavior as `-Wsuggest-override` in GCC >= 9. In GCC <9, it would suggest adding `override` to `void foo() final`, but in GCC >=9, `final` is enough to suppress the warning. This patch's `-Wsuggest-override`, as well as Clang's pre-existing `-Winconsistent-missing-override`, are also silenced by `final`. (https://godbolt.org/z/hbxLK6)

I built Clang itself with a Clang that had this patch, and with GCC with `-Wsuggest-override`, and compared the results--they were identical (except for the warning text). (618 warnings, for those interested.)


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