From 672207c319a06f20dc634bcd21678d5dbbe7a6b9 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Thu, 9 Apr 2020 22:47:09 +0100 Subject: [PATCH] [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 --- .../clang-tidy/bugprone/ArgumentCommentCheck.cpp | 20 ++++++++++---------- .../bugprone/NotNullTerminatedResultCheck.cpp | 2 +- .../bugprone/NotNullTerminatedResultCheck.h | 2 +- .../clang-tidy/bugprone/SizeofExpressionCheck.cpp | 8 ++++---- .../clang-tidy/bugprone/StringConstructorCheck.cpp | 2 +- .../clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp | 2 +- .../bugprone/SuspiciousStringCompareCheck.cpp | 5 +++-- .../clang-tidy/cppcoreguidelines/MacroUsageCheck.h | 4 ++-- .../cppcoreguidelines/NarrowingConversionsCheck.cpp | 4 ++-- .../SpecialMemberFunctionsCheck.cpp | 8 ++++---- .../clang-tidy/hicpp/MultiwayPathsCoveredCheck.h | 2 +- .../clang-tidy/misc/UnusedParametersCheck.cpp | 2 +- .../clang-tidy/modernize/AvoidBindCheck.cpp | 2 +- .../clang-tidy/modernize/PassByValueCheck.cpp | 2 +- .../clang-tidy/modernize/UseAutoCheck.cpp | 2 +- .../modernize/UseDefaultMemberInitCheck.cpp | 4 ++-- .../clang-tidy/modernize/UseEmplaceCheck.cpp | 4 ++-- .../clang-tidy/modernize/UseEqualsDefaultCheck.cpp | 2 +- .../clang-tidy/modernize/UseEqualsDeleteCheck.h | 2 +- .../modernize/UseTransparentFunctorsCheck.cpp | 2 +- .../clang-tidy/performance/ForRangeCopyCheck.cpp | 2 +- .../InefficientStringConcatenationCheck.cpp | 2 +- .../clang-tidy/portability/SIMDIntrinsicsCheck.cpp | 2 +- .../clang-tidy/readability/IdentifierNamingCheck.cpp | 4 ++-- .../InconsistentDeclarationParameterNameCheck.h | 4 ++-- .../readability/RedundantMemberInitCheck.h | 2 +- .../readability/RedundantSmartptrGetCheck.h | 2 +- .../readability/SimplifyBooleanExprCheck.cpp | 5 ++--- .../readability/UppercaseLiteralSuffixCheck.cpp | 2 +- 29 files changed, 53 insertions(+), 53 deletions(-) diff --git a/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp index 4da91d1..5ec4c77 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 9347dac..87c1c85 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 4848e34..f2a7cd3 100644 --- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h @@ -36,7 +36,7 @@ private: // 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 1eb5a2f..ecaee65 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 598fb38..1c47f17 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 ec088ec..337c369 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 a939159..028e88e 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 6875abe..1938eb6 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h @@ -27,8 +27,8 @@ public: 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 5731116..2f521ce 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 b7f5eb6..9c16436 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 d21afbb5..6c2a45f 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 b1507ed..91d8874 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 710d90e..b45d9c5 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 315ee29..ae4837f 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 b4d920f..4791bd6 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 04cc7aa..5ce4986 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 a8ae8f0..b84b0cd 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 bb7c8f5..0960349 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 10c4e43..c77339b 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 e55e2fa..6794254 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 67a6202..579d4fa 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 8b48093a..c883fc2 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 86734b9..3f5cf18 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 478122a..9146e73 100644 --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -139,8 +139,8 @@ private: 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 { diff --git a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h index e20adea..aac2f50 100644 --- a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h +++ b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h @@ -27,8 +27,8 @@ public: 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 438db4c..9454278 100644 --- a/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h +++ b/clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.h @@ -25,7 +25,7 @@ public: 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 4d2d9bf..3214863 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 74ef565..fb33e50 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 { 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 f99a8b9..70d2a10 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) { -- 2.7.4