Author: Mitchell Balan Date: 2019-11-19T07:52:31-05:00 New Revision: 41ee54e5d18858c56725485ef637ad5a686368f4
URL: https://github.com/llvm/llvm-project/commit/41ee54e5d18858c56725485ef637ad5a686368f4 DIFF: https://github.com/llvm/llvm-project/commit/41ee54e5d18858c56725485ef637ad5a686368f4.diff LOG: Revert "[clang-tidy] Fix readability-redundant-string-init for c++17/c++2a" This reverts commit 06f3dabe4a2e85a32ade27c0769b6084c828a206. Added: Modified: clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.h clang-tools-extra/docs/ReleaseNotes.rst clang-tools-extra/docs/clang-tidy/checks/modernize-use-override.rst Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp index 8ee77ccd16ff..2f15213dca8c 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp @@ -20,13 +20,11 @@ namespace modernize { UseOverrideCheck::UseOverrideCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), IgnoreDestructors(Options.get("IgnoreDestructors", false)), - AllowOverrideAndFinal(Options.get("AllowOverrideAndFinal", false)), OverrideSpelling(Options.get("OverrideSpelling", "override")), FinalSpelling(Options.get("FinalSpelling", "final")) {} void UseOverrideCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { Options.store(Opts, "IgnoreDestructors", IgnoreDestructors); - Options.store(Opts, "AllowOverrideAndFinal", AllowOverrideAndFinal); Options.store(Opts, "OverrideSpelling", OverrideSpelling); Options.store(Opts, "FinalSpelling", FinalSpelling); } @@ -105,8 +103,7 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) { bool OnlyVirtualSpecified = HasVirtual && !HasOverride && !HasFinal; unsigned KeywordCount = HasVirtual + HasOverride + HasFinal; - if ((!OnlyVirtualSpecified && KeywordCount == 1) || - (!HasVirtual && HasOverride && HasFinal && AllowOverrideAndFinal)) + if (!OnlyVirtualSpecified && KeywordCount == 1) return; // Nothing to do. std::string Message; @@ -116,9 +113,8 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) { Message = "annotate this function with '%0' or (rarely) '%1'"; } else { StringRef Redundant = - HasVirtual ? (HasOverride && HasFinal && !AllowOverrideAndFinal - ? "'virtual' and '%0' are" - : "'virtual' is") + HasVirtual ? (HasOverride && HasFinal ? "'virtual' and '%0' are" + : "'virtual' is") : "'%0' is"; StringRef Correct = HasFinal ? "'%1'" : "'%0'"; @@ -215,7 +211,7 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) { Diag << FixItHint::CreateInsertion(InsertLoc, ReplacementText); } - if (HasFinal && HasOverride && !AllowOverrideAndFinal) { + if (HasFinal && HasOverride) { SourceLocation OverrideLoc = Method->getAttr<OverrideAttr>()->getLocation(); Diag << FixItHint::CreateRemoval( CharSourceRange::getTokenRange(OverrideLoc, OverrideLoc)); diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.h b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.h index 082778f2957c..ed163956ecdb 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.h +++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.h @@ -26,7 +26,6 @@ class UseOverrideCheck : public ClangTidyCheck { private: const bool IgnoreDestructors; - const bool AllowOverrideAndFinal; const std::string OverrideSpelling; const std::string FinalSpelling; }; diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index b9feee29d137..4e773d62bf6b 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -170,12 +170,6 @@ Improvements to clang-tidy Finds non-static member functions that can be made ``const`` because the functions don't use ``this`` in a non-const way. -- Improved :doc:`modernize-use-override - <clang-tidy/checks/modernize-use-override>` check. - - The check now supports the ``AllowOverrideAndFinal`` option to eliminate - conflicts with ``gcc -Wsuggest-override`` or ``gcc -Werror=suggest-override``. - - The :doc:`readability-redundant-string-init <clang-tidy/checks/readability-redundant-string-init>` check now supports a `StringNames` option enabling its application to custom string classes. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-override.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-override.rst index d20c1d88520e..4273c6e57708 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-override.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-override.rst @@ -27,14 +27,6 @@ Options If set to non-zero, this check will not diagnose destructors. Default is `0`. -.. option:: AllowOverrideAndFinal - - If set to non-zero, this check will not diagnose ``override`` as redundant - with ``final``. This is useful when code will be compiled by a compiler with - warning/error checking flags requiring ``override`` explicitly on overriden - members, such as ``gcc -Wsuggest-override``/``gcc -Werror=suggest-override``. - Default is `0`. - .. option:: OverrideSpelling Specifies a macro to use instead of ``override``. This is useful when _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits