@@ -71,10 +71,10 @@ const Expr *getBoolLiteral(const MatchFinder::MatchResult &Result,
71
71
}
72
72
73
73
internal::BindableMatcher<Stmt> literalOrNegatedBool (bool Value) {
74
- return expr (anyOf ( cxxBoolLiteral ( equals (Value)),
75
- unaryOperator ( hasUnaryOperand ( ignoringParenImpCasts (
76
- cxxBoolLiteral (equals (!Value) ))),
77
- hasOperatorName (" !" ))));
74
+ return expr (
75
+ anyOf ( cxxBoolLiteral ( equals (Value)),
76
+ unaryOperator ( hasUnaryOperand ( cxxBoolLiteral (equals (!Value))),
77
+ hasOperatorName (" !" ))));
78
78
}
79
79
80
80
internal::Matcher<Stmt> returnsBool (bool Value, StringRef Id = " ignored" ) {
@@ -443,8 +443,7 @@ void SimplifyBooleanExprCheck::matchBoolCondition(MatchFinder *Finder,
443
443
bool Value,
444
444
StringRef BooleanId) {
445
445
Finder->addMatcher (
446
- ifStmt (unless (isInTemplateInstantiation ()),
447
- hasCondition (literalOrNegatedBool (Value).bind (BooleanId)))
446
+ ifStmt (hasCondition (literalOrNegatedBool (Value).bind (BooleanId)))
448
447
.bind (IfStmtId),
449
448
this );
450
449
}
@@ -453,8 +452,7 @@ void SimplifyBooleanExprCheck::matchTernaryResult(MatchFinder *Finder,
453
452
bool Value,
454
453
StringRef TernaryId) {
455
454
Finder->addMatcher (
456
- conditionalOperator (unless (isInTemplateInstantiation ()),
457
- hasTrueExpression (literalOrNegatedBool (Value)),
455
+ conditionalOperator (hasTrueExpression (literalOrNegatedBool (Value)),
458
456
hasFalseExpression (literalOrNegatedBool (!Value)))
459
457
.bind (TernaryId),
460
458
this );
@@ -463,14 +461,12 @@ void SimplifyBooleanExprCheck::matchTernaryResult(MatchFinder *Finder,
463
461
void SimplifyBooleanExprCheck::matchIfReturnsBool (MatchFinder *Finder,
464
462
bool Value, StringRef Id) {
465
463
if (ChainedConditionalReturn)
466
- Finder->addMatcher (ifStmt (unless (isInTemplateInstantiation ()),
467
- hasThen (returnsBool (Value, ThenLiteralId)),
464
+ Finder->addMatcher (ifStmt (hasThen (returnsBool (Value, ThenLiteralId)),
468
465
hasElse (returnsBool (!Value)))
469
466
.bind (Id),
470
467
this );
471
468
else
472
- Finder->addMatcher (ifStmt (unless (isInTemplateInstantiation ()),
473
- unless (hasParent (ifStmt ())),
469
+ Finder->addMatcher (ifStmt (unless (hasParent (ifStmt ())),
474
470
hasThen (returnsBool (Value, ThenLiteralId)),
475
471
hasElse (returnsBool (!Value)))
476
472
.bind (Id),
@@ -495,28 +491,22 @@ void SimplifyBooleanExprCheck::matchIfAssignsBool(MatchFinder *Finder,
495
491
auto Else = anyOf (SimpleElse, compoundStmt (statementCountIs (1 ),
496
492
hasAnySubstatement (SimpleElse)));
497
493
if (ChainedConditionalAssignment)
498
- Finder->addMatcher (ifStmt (unless (isInTemplateInstantiation ()),
499
- hasThen (Then), hasElse (Else))
500
- .bind (Id),
501
- this );
494
+ Finder->addMatcher (ifStmt (hasThen (Then), hasElse (Else)).bind (Id), this );
502
495
else
503
- Finder->addMatcher (ifStmt (unless (isInTemplateInstantiation ()),
504
- unless (hasParent (ifStmt ())), hasThen (Then),
505
- hasElse (Else))
506
- .bind (Id),
507
- this );
496
+ Finder->addMatcher (
497
+ ifStmt (unless (hasParent (ifStmt ())), hasThen (Then), hasElse (Else))
498
+ .bind (Id),
499
+ this );
508
500
}
509
501
510
502
void SimplifyBooleanExprCheck::matchCompoundIfReturnsBool (MatchFinder *Finder,
511
503
bool Value,
512
504
StringRef Id) {
513
505
Finder->addMatcher (
514
506
compoundStmt (
515
- unless (isInTemplateInstantiation ()),
516
507
hasAnySubstatement (
517
508
ifStmt (hasThen (returnsBool (Value)), unless (hasElse (stmt ())))),
518
- hasAnySubstatement (returnStmt (has (ignoringParenImpCasts (
519
- literalOrNegatedBool (!Value))))
509
+ hasAnySubstatement (returnStmt (has (literalOrNegatedBool (!Value)))
520
510
.bind (CompoundReturnId)))
521
511
.bind (Id),
522
512
this );
0 commit comments