Skip to content

Commit

Permalink
[clang-tidy][NFC] Remove ModernizeTidyModule::getModuleOptions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carlosgalvezp committed Feb 15, 2023
1 parent c7f9344 commit 45ddc15
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
17 changes: 0 additions & 17 deletions clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
Expand Up @@ -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, ",");
}

Expand Down

0 comments on commit 45ddc15

Please sign in to comment.