[clang-tools-extra] r362706 - [clang-tidy] Another attempt to fix misc-redundant-expression check.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 6 06:43:38 PDT 2019
Author: hokein
Date: Thu Jun 6 06:43:38 2019
New Revision: 362706
URL: http://llvm.org/viewvc/llvm-project?rev=362706&view=rev
Log:
[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.
Modified:
clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp?rev=362706&r1=362705&r2=362706&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp Thu Jun 6 06:43:38 2019
@@ -291,7 +291,7 @@ static void transformSubToCanonicalAddEx
}
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 retrieveRelationalIntegerCon
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());
More information about the cfe-commits
mailing list