@@ -349,26 +349,27 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
349349 forField (hasBitWidth (1 )))));
350350
351351 Finder->addMatcher (
352- traverse (TK_AsIs, implicitCastExpr (
353- ImplicitCastFromBool, unless (ExceptionCases),
354- // Exclude comparisons of bools, as they are
355- // always cast to integers in such context:
356- // bool_expr_a == bool_expr_b
357- // bool_expr_a != bool_expr_b
358- unless (hasParent (binaryOperator (anyOf (
359- BoolComparison, BoolXor, BoolOpAssignment,
360- BitfieldAssignment)))),
361- implicitCastExpr ().bind (" implicitCastFromBool" ),
362- unless (hasParent (BitfieldConstruct)),
363- // Check also for nested casts, for example:
364- // bool -> int -> float.
365- anyOf (hasParent (implicitCastExpr ().bind (
366- " furtherImplicitCast" )),
367- anything ()),
368- unless (isInTemplateInstantiation ()),
369- unless (IsInCompilerGeneratedFunction))),
352+ traverse (
353+ TK_AsIs,
354+ implicitCastExpr (
355+ ImplicitCastFromBool, unless (ExceptionCases),
356+ // Exclude comparisons of bools, as they are
357+ // always cast to integers in such context:
358+ // bool_expr_a == bool_expr_b
359+ // bool_expr_a != bool_expr_b
360+ unless (hasParent (binaryOperator (anyOf (BoolComparison, BoolXor,
361+ BoolOpAssignment,
362+ BitfieldAssignment)))),
363+ implicitCastExpr ().bind (" implicitCastFromBool" ),
364+ unless (hasParent (BitfieldConstruct)),
365+ // Check also for nested casts, for example:
366+ // bool -> int -> float.
367+ anyOf (hasParent (implicitCastExpr ().bind (" furtherImplicitCast" )),
368+ anything ()),
369+ unless (isInTemplateInstantiation ()),
370+ unless (IsInCompilerGeneratedFunction))),
370371 this );
371- }
372+ }
372373}
373374
374375void ImplicitBoolConversionCheck::check (
0 commit comments