[all-commits] [llvm/llvm-project] 111167: [clang] Add -Wsuggest-override

kepler-5 via All-commits all-commits at lists.llvm.org
Sun Jul 12 16:05:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 111167895d47558989f9f3a593a82527b016c7e7
      https://github.com/llvm/llvm-project/commit/111167895d47558989f9f3a593a82527b016c7e7
  Author: Logan Smith <logan.r.smith0 at gmail.com>
  Date:   2020-07-12 (Sun, 12 Jul 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaDeclCXX.cpp
    A clang/test/SemaCXX/warn-suggest-destructor-override
    A clang/test/SemaCXX/warn-suggest-override

  Log Message:
  -----------
  [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




More information about the All-commits mailing list