[clang-tidy] Another attempt to fix misc-redundant-expression check.

Correct the fix of rL3627011, the isValueDependent guard was added in a wrong place in rL362701.

llvm-svn: 362706
This commit is contained in:
Haojian Wu 2019-06-06 13:43:38 +00:00
parent 71d3f227a7
commit a4f5a2ad1f
1 changed files with 6 additions and 5 deletions

View File

@ -291,7 +291,7 @@ static void transformSubToCanonicalAddExpr(BinaryOperatorKind &Opcode,
}
AST_MATCHER(Expr, isIntegerConstantExpr) {
if (Node.isInstantiationDependent() || Node.isValueDependent())
if (Node.isInstantiationDependent())
return false;
return Node.isIntegerConstantExpr(Finder->getASTContext());
}
@ -523,10 +523,11 @@ static bool retrieveRelationalIntegerConstantExpr(
if (canOverloadedOperatorArgsBeModified(OverloadedFunctionDecl, false))
return false;
if (!OverloadedOperatorExpr->getArg(1)->isIntegerConstantExpr(
Value, *Result.Context))
return false;
if (const auto *Arg = OverloadedOperatorExpr->getArg(1)) {
if (!Arg->isValueDependent() &&
!Arg->isIntegerConstantExpr(Value, *Result.Context))
return false;
}
Symbol = OverloadedOperatorExpr->getArg(0);
OperandExpr = OverloadedOperatorExpr;
Opcode = BinaryOperator::getOverloadedOpcode(OverloadedOperatorExpr->getOperator());