[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
This commit is contained in:
Nathan James 2020-04-09 22:47:09 +01:00
parent 8e2daa0c7f
commit 672207c319
29 changed files with 53 additions and 53 deletions

View File

@ -23,16 +23,16 @@ namespace bugprone {
ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name, ArgumentCommentCheck::ArgumentCommentCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
StrictMode(Options.getLocalOrGlobal("StrictMode", 0) != 0), StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
IgnoreSingleArgument(Options.get("IgnoreSingleArgument", 0) != 0), IgnoreSingleArgument(Options.get("IgnoreSingleArgument", false)),
CommentBoolLiterals(Options.get("CommentBoolLiterals", 0) != 0), CommentBoolLiterals(Options.get("CommentBoolLiterals", false)),
CommentIntegerLiterals(Options.get("CommentIntegerLiterals", 0) != 0), CommentIntegerLiterals(Options.get("CommentIntegerLiterals", false)),
CommentFloatLiterals(Options.get("CommentFloatLiterals", 0) != 0), CommentFloatLiterals(Options.get("CommentFloatLiterals", false)),
CommentStringLiterals(Options.get("CommentStringLiterals", 0) != 0), CommentStringLiterals(Options.get("CommentStringLiterals", false)),
CommentUserDefinedLiterals(Options.get("CommentUserDefinedLiterals", 0) != CommentUserDefinedLiterals(
0), Options.get("CommentUserDefinedLiterals", false)),
CommentCharacterLiterals(Options.get("CommentCharacterLiterals", 0) != 0), CommentCharacterLiterals(Options.get("CommentCharacterLiterals", false)),
CommentNullPtrs(Options.get("CommentNullPtrs", 0) != 0), CommentNullPtrs(Options.get("CommentNullPtrs", false)),
IdentRE("^(/\\* *)([_A-Za-z][_A-Za-z0-9]*)( *= *\\*/)$") {} IdentRE("^(/\\* *)([_A-Za-z][_A-Za-z0-9]*)( *= *\\*/)$") {}
void ArgumentCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void ArgumentCommentCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {

View File

@ -499,7 +499,7 @@ static void insertNullTerminatorExpr(StringRef Name,
NotNullTerminatedResultCheck::NotNullTerminatedResultCheck( NotNullTerminatedResultCheck::NotNullTerminatedResultCheck(
StringRef Name, ClangTidyContext *Context) StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WantToUseSafeFunctions(Options.get("WantToUseSafeFunctions", 1)) {} WantToUseSafeFunctions(Options.get("WantToUseSafeFunctions", true)) {}
void NotNullTerminatedResultCheck::storeOptions( void NotNullTerminatedResultCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { ClangTidyOptions::OptionMap &Opts) {

View File

@ -36,7 +36,7 @@ private:
// If non-zero it is specifying if the target environment is considered to // If non-zero it is specifying if the target environment is considered to
// implement '_s' suffixed memory and string handler functions which are safer // implement '_s' suffixed memory and string handler functions which are safer
// than older version (e.g. 'memcpy_s()'). The default value is '1'. // than older version (e.g. 'memcpy_s()'). The default value is '1'.
const int WantToUseSafeFunctions; const bool WantToUseSafeFunctions;
bool UseSafeFunctions = false; bool UseSafeFunctions = false;

View File

@ -60,12 +60,12 @@ CharUnits getSizeOfType(const ASTContext &Ctx, const Type *Ty) {
SizeofExpressionCheck::SizeofExpressionCheck(StringRef Name, SizeofExpressionCheck::SizeofExpressionCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WarnOnSizeOfConstant(Options.get("WarnOnSizeOfConstant", 1) != 0), WarnOnSizeOfConstant(Options.get("WarnOnSizeOfConstant", true)),
WarnOnSizeOfIntegerExpression( WarnOnSizeOfIntegerExpression(
Options.get("WarnOnSizeOfIntegerExpression", 0) != 0), Options.get("WarnOnSizeOfIntegerExpression", false)),
WarnOnSizeOfThis(Options.get("WarnOnSizeOfThis", 1) != 0), WarnOnSizeOfThis(Options.get("WarnOnSizeOfThis", true)),
WarnOnSizeOfCompareToConstant( WarnOnSizeOfCompareToConstant(
Options.get("WarnOnSizeOfCompareToConstant", 1) != 0) {} Options.get("WarnOnSizeOfCompareToConstant", true)) {}
void SizeofExpressionCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void SizeofExpressionCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "WarnOnSizeOfConstant", WarnOnSizeOfConstant); Options.store(Opts, "WarnOnSizeOfConstant", WarnOnSizeOfConstant);

View File

@ -26,7 +26,7 @@ AST_MATCHER_P(IntegerLiteral, isBiggerThan, unsigned, N) {
StringConstructorCheck::StringConstructorCheck(StringRef Name, StringConstructorCheck::StringConstructorCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WarnOnLargeLength(Options.get("WarnOnLargeLength", 1) != 0), WarnOnLargeLength(Options.get("WarnOnLargeLength", true)),
LargeLengthThreshold(Options.get("LargeLengthThreshold", 0x800000)) {} LargeLengthThreshold(Options.get("LargeLengthThreshold", 0x800000)) {}
void StringConstructorCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void StringConstructorCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {

View File

@ -110,7 +110,7 @@ static bool isPossiblyBitMask(const EnumDecl *EnumDec) {
SuspiciousEnumUsageCheck::SuspiciousEnumUsageCheck(StringRef Name, SuspiciousEnumUsageCheck::SuspiciousEnumUsageCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
StrictMode(Options.getLocalOrGlobal("StrictMode", 0)) {} StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
void SuspiciousEnumUsageCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void SuspiciousEnumUsageCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "StrictMode", StrictMode); Options.store(Opts, "StrictMode", StrictMode);

View File

@ -69,8 +69,9 @@ static const char KnownStringCompareFunctions[] = "__builtin_memcmp;"
SuspiciousStringCompareCheck::SuspiciousStringCompareCheck( SuspiciousStringCompareCheck::SuspiciousStringCompareCheck(
StringRef Name, ClangTidyContext *Context) StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WarnOnImplicitComparison(Options.get("WarnOnImplicitComparison", 1)), WarnOnImplicitComparison(Options.get("WarnOnImplicitComparison", true)),
WarnOnLogicalNotComparison(Options.get("WarnOnLogicalNotComparison", 0)), WarnOnLogicalNotComparison(
Options.get("WarnOnLogicalNotComparison", false)),
StringCompareLikeFunctions( StringCompareLikeFunctions(
Options.get("StringCompareLikeFunctions", "")) {} Options.get("StringCompareLikeFunctions", "")) {}

View File

@ -27,8 +27,8 @@ public:
MacroUsageCheck(StringRef Name, ClangTidyContext *Context) MacroUsageCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
AllowedRegexp(Options.get("AllowedRegexp", "^DEBUG_*")), AllowedRegexp(Options.get("AllowedRegexp", "^DEBUG_*")),
CheckCapsOnly(Options.get("CheckCapsOnly", 0)), CheckCapsOnly(Options.get("CheckCapsOnly", false)),
IgnoreCommandLineMacros(Options.get("IgnoreCommandLineMacros", 1)) {} IgnoreCommandLineMacros(Options.get("IgnoreCommandLineMacros", true)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus11; return LangOpts.CPlusPlus11;
} }

View File

@ -26,8 +26,8 @@ NarrowingConversionsCheck::NarrowingConversionsCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WarnOnFloatingPointNarrowingConversion( WarnOnFloatingPointNarrowingConversion(
Options.get("WarnOnFloatingPointNarrowingConversion", 1)), Options.get("WarnOnFloatingPointNarrowingConversion", true)),
PedanticMode(Options.get("PedanticMode", 0)) {} PedanticMode(Options.get("PedanticMode", false)) {}
void NarrowingConversionsCheck::registerMatchers(MatchFinder *Finder) { void NarrowingConversionsCheck::registerMatchers(MatchFinder *Finder) {
// ceil() and floor() are guaranteed to return integers, even though the type // ceil() and floor() are guaranteed to return integers, even though the type

View File

@ -23,11 +23,11 @@ namespace cppcoreguidelines {
SpecialMemberFunctionsCheck::SpecialMemberFunctionsCheck( SpecialMemberFunctionsCheck::SpecialMemberFunctionsCheck(
StringRef Name, ClangTidyContext *Context) StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context), AllowMissingMoveFunctions(Options.get(
AllowMissingMoveFunctions(Options.get("AllowMissingMoveFunctions", 0)), "AllowMissingMoveFunctions", false)),
AllowSoleDefaultDtor(Options.get("AllowSoleDefaultDtor", 0)), AllowSoleDefaultDtor(Options.get("AllowSoleDefaultDtor", false)),
AllowMissingMoveFunctionsWhenCopyIsDeleted( AllowMissingMoveFunctionsWhenCopyIsDeleted(
Options.get("AllowMissingMoveFunctionsWhenCopyIsDeleted", 0)) {} Options.get("AllowMissingMoveFunctionsWhenCopyIsDeleted", false)) {}
void SpecialMemberFunctionsCheck::storeOptions( void SpecialMemberFunctionsCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { ClangTidyOptions::OptionMap &Opts) {

View File

@ -27,7 +27,7 @@ class MultiwayPathsCoveredCheck : public ClangTidyCheck {
public: public:
MultiwayPathsCoveredCheck(StringRef Name, ClangTidyContext *Context) MultiwayPathsCoveredCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WarnOnMissingElse(Options.get("WarnOnMissingElse", 0)) {} WarnOnMissingElse(Options.get("WarnOnMissingElse", false)) {}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override; void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override; void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override;

View File

@ -123,7 +123,7 @@ UnusedParametersCheck::~UnusedParametersCheck() = default;
UnusedParametersCheck::UnusedParametersCheck(StringRef Name, UnusedParametersCheck::UnusedParametersCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
StrictMode(Options.getLocalOrGlobal("StrictMode", 0) != 0) {} StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void UnusedParametersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "StrictMode", StrictMode); Options.store(Opts, "StrictMode", StrictMode);

View File

@ -576,7 +576,7 @@ getForwardedArgumentList(const LambdaProperties &P) {
} }
AvoidBindCheck::AvoidBindCheck(StringRef Name, ClangTidyContext *Context) AvoidBindCheck::AvoidBindCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
PermissiveParameterList(Options.get("PermissiveParameterList", 0) != 0) {} PermissiveParameterList(Options.get("PermissiveParameterList", false)) {}
void AvoidBindCheck::registerMatchers(MatchFinder *Finder) { void AvoidBindCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher( Finder->addMatcher(

View File

@ -123,7 +123,7 @@ PassByValueCheck::PassByValueCheck(StringRef Name, ClangTidyContext *Context)
IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", IncludeStyle(Options.getLocalOrGlobal("IncludeStyle",
utils::IncludeSorter::getMapping(), utils::IncludeSorter::getMapping(),
utils::IncludeSorter::IS_LLVM)), utils::IncludeSorter::IS_LLVM)),
ValuesOnly(Options.get("ValuesOnly", 0) != 0) {} ValuesOnly(Options.get("ValuesOnly", false)) {}
void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IncludeStyle", IncludeStyle, Options.store(Opts, "IncludeStyle", IncludeStyle,

View File

@ -317,7 +317,7 @@ StatementMatcher makeCombinedMatcher() {
UseAutoCheck::UseAutoCheck(StringRef Name, ClangTidyContext *Context) UseAutoCheck::UseAutoCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
MinTypeNameLength(Options.get("MinTypeNameLength", 5)), MinTypeNameLength(Options.get("MinTypeNameLength", 5)),
RemoveStars(Options.get("RemoveStars", 0)) {} RemoveStars(Options.get("RemoveStars", false)) {}
void UseAutoCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void UseAutoCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "MinTypeNameLength", MinTypeNameLength); Options.store(Opts, "MinTypeNameLength", MinTypeNameLength);

View File

@ -186,8 +186,8 @@ static bool sameValue(const Expr *E1, const Expr *E2) {
UseDefaultMemberInitCheck::UseDefaultMemberInitCheck(StringRef Name, UseDefaultMemberInitCheck::UseDefaultMemberInitCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
UseAssignment(Options.get("UseAssignment", 0) != 0), UseAssignment(Options.get("UseAssignment", false)),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true) != 0) {} IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
void UseDefaultMemberInitCheck::storeOptions( void UseDefaultMemberInitCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { ClangTidyOptions::OptionMap &Opts) {

View File

@ -28,8 +28,8 @@ const auto DefaultTupleMakeFunctions = "::std::make_pair; ::std::make_tuple";
} // namespace } // namespace
UseEmplaceCheck::UseEmplaceCheck(StringRef Name, ClangTidyContext *Context) UseEmplaceCheck::UseEmplaceCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context), IgnoreImplicitConstructors(Options.get(
IgnoreImplicitConstructors(Options.get("IgnoreImplicitConstructors", 0)), "IgnoreImplicitConstructors", false)),
ContainersWithPushBack(utils::options::parseStringList(Options.get( ContainersWithPushBack(utils::options::parseStringList(Options.get(
"ContainersWithPushBack", DefaultContainersWithPushBack))), "ContainersWithPushBack", DefaultContainersWithPushBack))),
SmartPointers(utils::options::parseStringList( SmartPointers(utils::options::parseStringList(

View File

@ -201,7 +201,7 @@ static bool bodyEmpty(const ASTContext *Context, const CompoundStmt *Body) {
UseEqualsDefaultCheck::UseEqualsDefaultCheck(StringRef Name, UseEqualsDefaultCheck::UseEqualsDefaultCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true) != 0) {} IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
void UseEqualsDefaultCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void UseEqualsDefaultCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IgnoreMacros", IgnoreMacros); Options.store(Opts, "IgnoreMacros", IgnoreMacros);

View File

@ -38,7 +38,7 @@ class UseEqualsDeleteCheck : public ClangTidyCheck {
public: public:
UseEqualsDeleteCheck(StringRef Name, ClangTidyContext *Context) UseEqualsDeleteCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0) {} IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus; return LangOpts.CPlusPlus;
} }

View File

@ -18,7 +18,7 @@ namespace modernize {
UseTransparentFunctorsCheck::UseTransparentFunctorsCheck( UseTransparentFunctorsCheck::UseTransparentFunctorsCheck(
StringRef Name, ClangTidyContext *Context) StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), SafeMode(Options.get("SafeMode", 0)) {} : ClangTidyCheck(Name, Context), SafeMode(Options.get("SafeMode", false)) {}
void UseTransparentFunctorsCheck::storeOptions( void UseTransparentFunctorsCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { ClangTidyOptions::OptionMap &Opts) {

View File

@ -23,7 +23,7 @@ namespace performance {
ForRangeCopyCheck::ForRangeCopyCheck(StringRef Name, ClangTidyContext *Context) ForRangeCopyCheck::ForRangeCopyCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
WarnOnAllAutoCopies(Options.get("WarnOnAllAutoCopies", 0)), WarnOnAllAutoCopies(Options.get("WarnOnAllAutoCopies", false)),
AllowedTypes( AllowedTypes(
utils::options::parseStringList(Options.get("AllowedTypes", ""))) {} utils::options::parseStringList(Options.get("AllowedTypes", ""))) {}

View File

@ -24,7 +24,7 @@ void InefficientStringConcatenationCheck::storeOptions(
InefficientStringConcatenationCheck::InefficientStringConcatenationCheck( InefficientStringConcatenationCheck::InefficientStringConcatenationCheck(
StringRef Name, ClangTidyContext *Context) StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
StrictMode(Options.getLocalOrGlobal("StrictMode", 0)) {} StrictMode(Options.getLocalOrGlobal("StrictMode", false)) {}
void InefficientStringConcatenationCheck::registerMatchers( void InefficientStringConcatenationCheck::registerMatchers(
MatchFinder *Finder) { MatchFinder *Finder) {

View File

@ -85,7 +85,7 @@ static StringRef TrySuggestX86(StringRef Name) {
SIMDIntrinsicsCheck::SIMDIntrinsicsCheck(StringRef Name, SIMDIntrinsicsCheck::SIMDIntrinsicsCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), Std(Options.get("Std", "")), : ClangTidyCheck(Name, Context), Std(Options.get("Std", "")),
Suggest(Options.get("Suggest", 0) != 0) {} Suggest(Options.get("Suggest", false)) {}
void SIMDIntrinsicsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { void SIMDIntrinsicsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "Std", ""); Options.store(Opts, "Std", "");

View File

@ -139,8 +139,8 @@ private:
IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name, IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: RenamerClangTidyCheck(Name, Context), : RenamerClangTidyCheck(Name, Context),
IgnoreFailedSplit(Options.get("IgnoreFailedSplit", 0)), IgnoreFailedSplit(Options.get("IgnoreFailedSplit", false)),
IgnoreMainLikeFunctions(Options.get("IgnoreMainLikeFunctions", 0)) { IgnoreMainLikeFunctions(Options.get("IgnoreMainLikeFunctions", false)) {
for (auto const &Name : StyleNames) { for (auto const &Name : StyleNames) {
auto CaseOptional = [&]() -> llvm::Optional<CaseType> { auto CaseOptional = [&]() -> llvm::Optional<CaseType> {

View File

@ -27,8 +27,8 @@ public:
InconsistentDeclarationParameterNameCheck(StringRef Name, InconsistentDeclarationParameterNameCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0), IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)),
Strict(Options.getLocalOrGlobal("Strict", 0) != 0) {} Strict(Options.getLocalOrGlobal("Strict", false)) {}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override; void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override; void registerMatchers(ast_matchers::MatchFinder *Finder) override;

View File

@ -25,7 +25,7 @@ public:
RedundantMemberInitCheck(StringRef Name, ClangTidyContext *Context) RedundantMemberInitCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
IgnoreBaseInCopyConstructors( IgnoreBaseInCopyConstructors(
Options.get("IgnoreBaseInCopyConstructors", 0)) {} Options.get("IgnoreBaseInCopyConstructors", false)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus; return LangOpts.CPlusPlus;
} }

View File

@ -28,7 +28,7 @@ class RedundantSmartptrGetCheck : public ClangTidyCheck {
public: public:
RedundantSmartptrGetCheck(StringRef Name, ClangTidyContext *Context) RedundantSmartptrGetCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0) {} IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus; return LangOpts.CPlusPlus;
} }

View File

@ -333,13 +333,12 @@ class SimplifyBooleanExprCheck::Visitor : public RecursiveASTVisitor<Visitor> {
const MatchFinder::MatchResult &Result; const MatchFinder::MatchResult &Result;
}; };
SimplifyBooleanExprCheck::SimplifyBooleanExprCheck(StringRef Name, SimplifyBooleanExprCheck::SimplifyBooleanExprCheck(StringRef Name,
ClangTidyContext *Context) ClangTidyContext *Context)
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
ChainedConditionalReturn(Options.get("ChainedConditionalReturn", 0U)), ChainedConditionalReturn(Options.get("ChainedConditionalReturn", false)),
ChainedConditionalAssignment( ChainedConditionalAssignment(
Options.get("ChainedConditionalAssignment", 0U)) {} Options.get("ChainedConditionalAssignment", false)) {}
bool containsBoolLiteral(const Expr *E) { bool containsBoolLiteral(const Expr *E) {
if (!E) if (!E)

View File

@ -183,7 +183,7 @@ UppercaseLiteralSuffixCheck::UppercaseLiteralSuffixCheck(
: ClangTidyCheck(Name, Context), : ClangTidyCheck(Name, Context),
NewSuffixes( NewSuffixes(
utils::options::parseStringList(Options.get("NewSuffixes", ""))), utils::options::parseStringList(Options.get("NewSuffixes", ""))),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", 1) != 0) {} IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
void UppercaseLiteralSuffixCheck::storeOptions( void UppercaseLiteralSuffixCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { ClangTidyOptions::OptionMap &Opts) {