[clang-tools-extra] [clang-tidy] Improve `google-explicit-constructor` checks handling of `explicit(bool)` (PR #82689)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 23 08:06:34 PST 2024
================
@@ -130,18 +134,30 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
return;
}
- if (Ctor->isExplicit() || Ctor->isCopyOrMoveConstructor() ||
+ if (ExplicitSpec.isExplicit() || Ctor->isCopyOrMoveConstructor() ||
TakesInitializerList)
return;
+ // Don't complain about explicit(false)
+ const Expr *ExplicitExpr = ExplicitSpec.getExpr();
+ if (ExplicitExpr) {
+ ExplicitExpr = ExplicitExpr->IgnoreImplicit();
+ if (isa<CXXBoolLiteralExpr>(ExplicitExpr))
+ return;
+ }
+
bool SingleArgument =
----------------
EugeneZelenko wrote:
Should be `const`.
https://github.com/llvm/llvm-project/pull/82689
More information about the cfe-commits
mailing list