[clang-tools-extra] 672207c - [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)?
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 12 15:06:17 PDT 2020
Author: Nathan James
Date: 2020-04-12T23:06:09+01:00
New Revision: 672207c319a06f20dc634bcd21678d5dbbe7a6b9
URL: https://github.com/llvm/llvm-project/commit/672207c319a06f20dc634bcd21678d5dbbe7a6b9
DIFF: https://github.com/llvm/llvm-project/commit/672207c319a06f20dc634bcd21678d5dbbe7a6b9.diff
LOG: [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)?
Summary: This was done with a script that looks for calls to Options.get(GlobalOrLocal) that take an integer for the second argument and the result is either compared not equal to 0 or implicitly converted to bool. There may be other occurances
Reviewers: aaron.ballman, alexfh, gribozavr2
Reviewed By: aaron.ballman
Subscribers: wuzish, nemanjai, xazax.hun, kbarton, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77831
Added:
Modified:
clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.h
clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
clang-tools-extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp
clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h
clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.h
clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
index 4da91d1162ac..5ec4c779d59a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -23,16 +23,16 @@ namespace bugprone {
ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- StrictMode(Options.getLocalOrGlobal("StrictMode", 0) != 0),
- IgnoreSingleArgument(Options.get("IgnoreSingleArgument", 0) != 0),
- CommentBoolLiterals(Options.get("CommentBoolLiterals", 0) != 0),
- CommentIntegerLiterals(Options.get("CommentIntegerLiterals", 0) != 0),
- CommentFloatLiterals(Options.get("CommentFloatLiterals", 0) != 0),
- CommentStringLiterals(Options.get("CommentStringLiterals", 0) != 0),
- CommentUserDefinedLiterals(Options.get("CommentUserDefinedLiterals", 0) !=
- 0),
- CommentCharacterLiterals(Options.get("CommentCharacterLiterals", 0) != 0),
- CommentNullPtrs(Options.get("CommentNullPtrs", 0) != 0),
+ StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
+ IgnoreSingleArgument(Options.get("IgnoreSingleArgument", false)),
+ CommentBoolLiterals(Options.get("CommentBoolLiterals", false)),
+ CommentIntegerLiterals(Options.get("CommentIntegerLiterals", false)),
+ CommentFloatLiterals(Options.get("CommentFloatLiterals", false)),
+ CommentStringLiterals(Options.get("CommentStringLiterals", false)),
+ CommentUserDefinedLiterals(
+ Options.get("CommentUserDefinedLiterals", false)),
+ CommentCharacterLiterals(Options.get("CommentCharacterLiterals", false)),
+ CommentNullPtrs(Options.get("CommentNullPtrs", false)),
IdentRE("^(/\\* *)([_A-Za-z][_A-Za-z0-9]*)( *= *\\*/)$") {}
void ArgumentCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
index 9347dacdbf15..87c1c85e7097 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
@@ -499,7 +499,7 @@ static void insertNullTerminatorExpr(StringRef Name,
NotNullTerminatedResultCheck::NotNullTerminatedResultCheck(
StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- WantToUseSafeFunctions(Options.get("WantToUseSafeFunctions", 1)) {}
+ WantToUseSafeFunctions(Options.get("WantToUseSafeFunctions", true)) {}
void NotNullTerminatedResultCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
index 4848e34568bf..f2a7cd3998f7 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
@@ -36,7 +36,7 @@ class NotNullTerminatedResultCheck : public ClangTidyCheck {
// If non-zero it is specifying if the target environment is considered to
// implement '_s' suffixed memory and string handler functions which are safer
// than older version (e.g. 'memcpy_s()'). The default value is '1'.
- const int WantToUseSafeFunctions;
+ const bool WantToUseSafeFunctions;
bool UseSafeFunctions = false;
diff --git a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
index 1eb5a2fa35e7..ecaee65b2ea6 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
@@ -60,12 +60,12 @@ CharUnits getSizeOfType(const ASTContext &Ctx, const Type *Ty) {
SizeofExpressionCheck::SizeofExpressionCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- WarnOnSizeOfConstant(Options.get("WarnOnSizeOfConstant", 1) != 0),
+ WarnOnSizeOfConstant(Options.get("WarnOnSizeOfConstant", true)),
WarnOnSizeOfIntegerExpression(
- Options.get("WarnOnSizeOfIntegerExpression", 0) != 0),
- WarnOnSizeOfThis(Options.get("WarnOnSizeOfThis", 1) != 0),
+ Options.get("WarnOnSizeOfIntegerExpression", false)),
+ WarnOnSizeOfThis(Options.get("WarnOnSizeOfThis", true)),
WarnOnSizeOfCompareToConstant(
- Options.get("WarnOnSizeOfCompareToConstant", 1) != 0) {}
+ Options.get("WarnOnSizeOfCompareToConstant", true)) {}
void SizeofExpressionCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "WarnOnSizeOfConstant", WarnOnSizeOfConstant);
diff --git a/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
index 598fb38c19b9..1c47f17d8a64 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
@@ -26,7 +26,7 @@ AST_MATCHER_P(IntegerLiteral, isBiggerThan, unsigned, N) {
StringConstructorCheck::StringConstructorCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- WarnOnLargeLength(Options.get("WarnOnLargeLength", 1) != 0),
+ WarnOnLargeLength(Options.get("WarnOnLargeLength", true)),
LargeLengthThreshold(Options.get("LargeLengthThreshold", 0x800000)) {}
void StringConstructorCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp
index ec088ec8de32..337c3691be05 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp
@@ -110,7 +110,7 @@ static bool isPossiblyBitMask(const EnumDecl *EnumDec) {
SuspiciousEnumUsageCheck::SuspiciousEnumUsageCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- StrictMode(Options.getLocalOrGlobal("StrictMode", 0)) {}
+ StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
void SuspiciousEnumUsageCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "StrictMode", StrictMode);
diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
index a939159f45fd..028e88e04617 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp
@@ -69,8 +69,9 @@ static const char KnownStringCompareFunctions[] = "__builtin_memcmp;"
SuspiciousStringCompareCheck::SuspiciousStringCompareCheck(
StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- WarnOnImplicitComparison(Options.get("WarnOnImplicitComparison", 1)),
- WarnOnLogicalNotComparison(Options.get("WarnOnLogicalNotComparison", 0)),
+ WarnOnImplicitComparison(Options.get("WarnOnImplicitComparison", true)),
+ WarnOnLogicalNotComparison(
+ Options.get("WarnOnLogicalNotComparison", false)),
StringCompareLikeFunctions(
Options.get("StringCompareLikeFunctions", "")) {}
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
index 6875abeb3cf4..1938eb672718 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
@@ -27,8 +27,8 @@ class MacroUsageCheck : public ClangTidyCheck {
MacroUsageCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
AllowedRegexp(Options.get("AllowedRegexp", "^DEBUG_*")),
- CheckCapsOnly(Options.get("CheckCapsOnly", 0)),
- IgnoreCommandLineMacros(Options.get("IgnoreCommandLineMacros", 1)) {}
+ CheckCapsOnly(Options.get("CheckCapsOnly", false)),
+ IgnoreCommandLineMacros(Options.get("IgnoreCommandLineMacros", true)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus11;
}
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
index 573111663be5..2f521ce6eefe 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
@@ -26,8 +26,8 @@ NarrowingConversionsCheck::NarrowingConversionsCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
WarnOnFloatingPointNarrowingConversion(
- Options.get("WarnOnFloatingPointNarrowingConversion", 1)),
- PedanticMode(Options.get("PedanticMode", 0)) {}
+ Options.get("WarnOnFloatingPointNarrowingConversion", true)),
+ PedanticMode(Options.get("PedanticMode", false)) {}
void NarrowingConversionsCheck::registerMatchers(MatchFinder *Finder) {
// ceil() and floor() are guaranteed to return integers, even though the type
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
index b7f5eb6e1e33..9c16436a273e 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
@@ -23,11 +23,11 @@ namespace cppcoreguidelines {
SpecialMemberFunctionsCheck::SpecialMemberFunctionsCheck(
StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context),
- AllowMissingMoveFunctions(Options.get("AllowMissingMoveFunctions", 0)),
- AllowSoleDefaultDtor(Options.get("AllowSoleDefaultDtor", 0)),
+ : ClangTidyCheck(Name, Context), AllowMissingMoveFunctions(Options.get(
+ "AllowMissingMoveFunctions", false)),
+ AllowSoleDefaultDtor(Options.get("AllowSoleDefaultDtor", false)),
AllowMissingMoveFunctionsWhenCopyIsDeleted(
- Options.get("AllowMissingMoveFunctionsWhenCopyIsDeleted", 0)) {}
+ Options.get("AllowMissingMoveFunctionsWhenCopyIsDeleted", false)) {}
void SpecialMemberFunctionsCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
diff --git a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.h b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.h
index d21afbb5c511..6c2a45f71634 100644
--- a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.h
+++ b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.h
@@ -27,7 +27,7 @@ class MultiwayPathsCoveredCheck : public ClangTidyCheck {
public:
MultiwayPathsCoveredCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- WarnOnMissingElse(Options.get("WarnOnMissingElse", 0)) {}
+ WarnOnMissingElse(Options.get("WarnOnMissingElse", false)) {}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
diff --git a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
index b1507ed81ba7..91d88747527e 100644
--- a/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
@@ -123,7 +123,7 @@ UnusedParametersCheck::~UnusedParametersCheck() = default;
UnusedParametersCheck::UnusedParametersCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- StrictMode(Options.getLocalOrGlobal("StrictMode", 0) != 0) {}
+ StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "StrictMode", StrictMode);
diff --git a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
index 710d90edebbd..b45d9c513e61 100644
--- a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
@@ -576,7 +576,7 @@ getForwardedArgumentList(const LambdaProperties &P) {
}
AvoidBindCheck::AvoidBindCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- PermissiveParameterList(Options.get("PermissiveParameterList", 0) != 0) {}
+ PermissiveParameterList(Options.get("PermissiveParameterList", false)) {}
void AvoidBindCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
index 315ee29c738a..ae4837fe3893 100644
--- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
@@ -123,7 +123,7 @@ PassByValueCheck::PassByValueCheck(StringRef Name, ClangTidyContext *Context)
IncludeStyle(Options.getLocalOrGlobal("IncludeStyle",
utils::IncludeSorter::getMapping(),
utils::IncludeSorter::IS_LLVM)),
- ValuesOnly(Options.get("ValuesOnly", 0) != 0) {}
+ ValuesOnly(Options.get("ValuesOnly", false)) {}
void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IncludeStyle", IncludeStyle,
diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
index b4d920f5d7df..4791bd6060d6 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
@@ -317,7 +317,7 @@ StatementMatcher makeCombinedMatcher() {
UseAutoCheck::UseAutoCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
MinTypeNameLength(Options.get("MinTypeNameLength", 5)),
- RemoveStars(Options.get("RemoveStars", 0)) {}
+ RemoveStars(Options.get("RemoveStars", false)) {}
void UseAutoCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "MinTypeNameLength", MinTypeNameLength);
diff --git a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
index 04cc7aa9d449..5ce49865a032 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
@@ -186,8 +186,8 @@ static bool sameValue(const Expr *E1, const Expr *E2) {
UseDefaultMemberInitCheck::UseDefaultMemberInitCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- UseAssignment(Options.get("UseAssignment", 0) != 0),
- IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true) != 0) {}
+ UseAssignment(Options.get("UseAssignment", false)),
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
void UseDefaultMemberInitCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
index a8ae8f0d6003..b84b0cd865e5 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
@@ -28,8 +28,8 @@ const auto DefaultTupleMakeFunctions = "::std::make_pair; ::std::make_tuple";
} // namespace
UseEmplaceCheck::UseEmplaceCheck(StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context),
- IgnoreImplicitConstructors(Options.get("IgnoreImplicitConstructors", 0)),
+ : ClangTidyCheck(Name, Context), IgnoreImplicitConstructors(Options.get(
+ "IgnoreImplicitConstructors", false)),
ContainersWithPushBack(utils::options::parseStringList(Options.get(
"ContainersWithPushBack", DefaultContainersWithPushBack))),
SmartPointers(utils::options::parseStringList(
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
index bb7c8f5d96f7..09603497e682 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -201,7 +201,7 @@ static bool bodyEmpty(const ASTContext *Context, const CompoundStmt *Body) {
UseEqualsDefaultCheck::UseEqualsDefaultCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true) != 0) {}
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
void UseEqualsDefaultCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IgnoreMacros", IgnoreMacros);
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h b/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
index 10c4e4395982..c77339bcdac7 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.h
@@ -38,7 +38,7 @@ class UseEqualsDeleteCheck : public ClangTidyCheck {
public:
UseEqualsDeleteCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0) {}
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
index e55e2fa1f849..6794254cd0a6 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
@@ -18,7 +18,7 @@ namespace modernize {
UseTransparentFunctorsCheck::UseTransparentFunctorsCheck(
StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context), SafeMode(Options.get("SafeMode", 0)) {}
+ : ClangTidyCheck(Name, Context), SafeMode(Options.get("SafeMode", false)) {}
void UseTransparentFunctorsCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
diff --git a/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp b/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
index 67a620227666..579d4fa3d786 100644
--- a/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/ForRangeCopyCheck.cpp
@@ -23,7 +23,7 @@ namespace performance {
ForRangeCopyCheck::ForRangeCopyCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- WarnOnAllAutoCopies(Options.get("WarnOnAllAutoCopies", 0)),
+ WarnOnAllAutoCopies(Options.get("WarnOnAllAutoCopies", false)),
AllowedTypes(
utils::options::parseStringList(Options.get("AllowedTypes", ""))) {}
diff --git a/clang-tools-extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp b/clang-tools-extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp
index 8b48093acfae..c883fc2f1f4a 100644
--- a/clang-tools-extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp
@@ -24,7 +24,7 @@ void InefficientStringConcatenationCheck::storeOptions(
InefficientStringConcatenationCheck::InefficientStringConcatenationCheck(
StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- StrictMode(Options.getLocalOrGlobal("StrictMode", 0)) {}
+ StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
void InefficientStringConcatenationCheck::registerMatchers(
MatchFinder *Finder) {
diff --git a/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp b/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
index 86734b932cdb..3f5cf18e12d8 100644
--- a/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
@@ -85,7 +85,7 @@ static StringRef TrySuggestX86(StringRef Name) {
SIMDIntrinsicsCheck::SIMDIntrinsicsCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), Std(Options.get("Std", "")),
- Suggest(Options.get("Suggest", 0) != 0) {}
+ Suggest(Options.get("Suggest", false)) {}
void SIMDIntrinsicsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "Std", "");
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 478122a42d21..9146e7356c9c 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -139,8 +139,8 @@ class IdentifierNamingCheckPPCallbacks : public PPCallbacks {
IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
ClangTidyContext *Context)
: RenamerClangTidyCheck(Name, Context),
- IgnoreFailedSplit(Options.get("IgnoreFailedSplit", 0)),
- IgnoreMainLikeFunctions(Options.get("IgnoreMainLikeFunctions", 0)) {
+ IgnoreFailedSplit(Options.get("IgnoreFailedSplit", false)),
+ IgnoreMainLikeFunctions(Options.get("IgnoreMainLikeFunctions", false)) {
for (auto const &Name : StyleNames) {
auto CaseOptional = [&]() -> llvm::Optional<CaseType> {
diff --git a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
index e20adeaeaa33..aac2f5060aa9 100644
--- a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
@@ -27,8 +27,8 @@ class InconsistentDeclarationParameterNameCheck : public ClangTidyCheck {
InconsistentDeclarationParameterNameCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0),
- Strict(Options.getLocalOrGlobal("Strict", 0) != 0) {}
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)),
+ Strict(Options.getLocalOrGlobal("Strict", false)) {}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h
index 438db4c722ff..9454278ca244 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h
@@ -25,7 +25,7 @@ class RedundantMemberInitCheck : public ClangTidyCheck {
RedundantMemberInitCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
IgnoreBaseInCopyConstructors(
- Options.get("IgnoreBaseInCopyConstructors", 0)) {}
+ Options.get("IgnoreBaseInCopyConstructors", false)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.h b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.h
index 4d2d9bf5f47c..3214863602ca 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.h
@@ -28,7 +28,7 @@ class RedundantSmartptrGetCheck : public ClangTidyCheck {
public:
RedundantSmartptrGetCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0) {}
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
diff --git a/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp b/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
index 74ef565a8bb5..fb33e50cb1ca 100644
--- a/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -333,13 +333,12 @@ class SimplifyBooleanExprCheck::Visitor : public RecursiveASTVisitor<Visitor> {
const MatchFinder::MatchResult &Result;
};
-
SimplifyBooleanExprCheck::SimplifyBooleanExprCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- ChainedConditionalReturn(Options.get("ChainedConditionalReturn", 0U)),
+ ChainedConditionalReturn(Options.get("ChainedConditionalReturn", false)),
ChainedConditionalAssignment(
- Options.get("ChainedConditionalAssignment", 0U)) {}
+ Options.get("ChainedConditionalAssignment", false)) {}
bool containsBoolLiteral(const Expr *E) {
if (!E)
diff --git a/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp b/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
index f99a8b9cb62f..70d2a10ae2d8 100644
--- a/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
@@ -183,7 +183,7 @@ UppercaseLiteralSuffixCheck::UppercaseLiteralSuffixCheck(
: ClangTidyCheck(Name, Context),
NewSuffixes(
utils::options::parseStringList(Options.get("NewSuffixes", ""))),
- IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0) {}
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
void UppercaseLiteralSuffixCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
More information about the cfe-commits
mailing list