[all-commits] [llvm/llvm-project] 50e995: [clang-tidy] modernize-use-override new option All...
mitchell-stellar via All-commits
all-commits at lists.llvm.org
Fri Nov 15 13:17:37 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 50e99563fb0459f5160572eef3c4e6062b8ad3f2
https://github.com/llvm/llvm-project/commit/50e99563fb0459f5160572eef3c4e6062b8ad3f2
Author: Mitchell Balan <mitchell at stellarscience.com>
Date: 2019-11-15 (Fri, 15 Nov 2019)
Changed paths:
M clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
M clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init-msvc.cpp
M clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp
Log Message:
-----------
[clang-tidy] modernize-use-override new option AllowOverrideAndFinal
Summary:
In addition to adding `override` wherever possible, clang-tidy's `modernize-use-override` nicely removes `virtual` when `override` or `final` is specified, and further removes override when final is specified. While this is great default behavior, when code needs to be compiled with gcc at high warning levels that include `gcc -Wsuggest-override` or `gcc -Werror=suggest-override`, clang-tidy's removal of the redundant `override` keyword causes gcc to emit a warning or error. This discrepancy / conflict has been noted by others including a comment on Stack Overflow and by Mozilla's Firefox developers.
This patch adds an AllowOverrideAndFinal option defaulting to 0 - thus preserving current behavior - that when enabled allows both `override` and `final` to co-exist, while still fixing all other issues.
The patch includes a test file verifying all combinations of virtual/override/final, and mentions the new option in the release notes.
Reviewers: alexfh, djasper, JonasToth
Patch by: poelmanc
Subscribers: JonasToth, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70165
More information about the All-commits
mailing list