[clang-tools-extra] 45ddc15 - [clang-tidy][NFC] Remove ModernizeTidyModule::getModuleOptions

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 02:38:44 PST 2023


Author: Carlos Galvez
Date: 2023-02-15T10:38:36Z
New Revision: 45ddc157ca7c464ebbea627da0f682b1554e2390

URL: https://github.com/llvm/llvm-project/commit/45ddc157ca7c464ebbea627da0f682b1554e2390
DIFF: https://github.com/llvm/llvm-project/commit/45ddc157ca7c464ebbea627da0f682b1554e2390.diff

LOG: [clang-tidy][NFC] Remove ModernizeTidyModule::getModuleOptions

Most of the options stated there are duplicated already in
the implementation of each check as a default value for
each option.

The only place where this is not the case is the nullptr
check. Move the default option there instead. Only the
HICPP guidelines alias this modernize check, and there is
nothing in the documentation that suggests it should have
a different default value than the main modernize check.

Differential Revision: https://reviews.llvm.org/D143843

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
    clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index 97d24e52e57f6..9f116f92c1fb1 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -100,23 +100,6 @@ class ModernizeModule : public ClangTidyModule {
         "modernize-use-uncaught-exceptions");
     CheckFactories.registerCheck<UseUsingCheck>("modernize-use-using");
   }
-
-  ClangTidyOptions getModuleOptions() override {
-    ClangTidyOptions Options;
-    auto &Opts = Options.CheckOptions;
-    // For types whose size in bytes is above this threshold, we prefer taking a
-    // const-reference than making a copy.
-    Opts["modernize-loop-convert.MaxCopySize"] = "16";
-
-    Opts["modernize-loop-convert.MinConfidence"] = "reasonable";
-    Opts["modernize-loop-convert.NamingStyle"] = "CamelCase";
-    Opts["modernize-pass-by-value.IncludeStyle"] = "llvm";    // Also: "google".
-    Opts["modernize-replace-auto-ptr.IncludeStyle"] = "llvm"; // Also: "google".
-
-    // Comma-separated list of macros that behave like NULL.
-    Opts["modernize-use-nullptr.NullMacros"] = "NULL";
-    return Options;
-  }
 };
 
 // Register the ModernizeTidyModule using this statically initialized variable.

diff  --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
index 927033449b331..47c647841d760 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -480,7 +480,7 @@ class CastSequenceVisitor : public RecursiveASTVisitor<CastSequenceVisitor> {
 
 UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context),
-      NullMacrosStr(Options.get("NullMacros", "")) {
+      NullMacrosStr(Options.get("NullMacros", "NULL")) {
   StringRef(NullMacrosStr).split(NullMacros, ",");
 }
 


        


More information about the cfe-commits mailing list