carlosgalvezp created this revision.
Herald added a subscriber: xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
carlosgalvezp requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143843
Files:
clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
Index: clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -480,7 +480,7 @@
UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- NullMacrosStr(Options.get("NullMacros", "")) {
+ NullMacrosStr(Options.get("NullMacros", "NULL")) {
StringRef(NullMacrosStr).split(NullMacros, ",");
}
Index: clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -100,23 +100,6 @@
"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.
Index: clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -480,7 +480,7 @@
UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- NullMacrosStr(Options.get("NullMacros", "")) {
+ NullMacrosStr(Options.get("NullMacros", "NULL")) {
StringRef(NullMacrosStr).split(NullMacros, ",");
}
Index: clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -100,23 +100,6 @@
"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.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits