From 55835f032b736c50e7aebc2da1b16746557d5043 Mon Sep 17 00:00:00 2001 From: "petro.zarytskyi" Date: Tue, 5 Mar 2024 19:24:55 +0200 Subject: [PATCH] Don't emit error statements when assigning array sub exprs --- lib/Differentiator/ErrorEstimator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Differentiator/ErrorEstimator.cpp b/lib/Differentiator/ErrorEstimator.cpp index 94e3cf319..358e36cfb 100644 --- a/lib/Differentiator/ErrorEstimator.cpp +++ b/lib/Differentiator/ErrorEstimator.cpp @@ -390,12 +390,13 @@ void ErrorEstimationHandler::ActBeforeFinalizingVisitCallExpr( void ErrorEstimationHandler::ActBeforeFinalizingAssignOp( clang::Expr*& LCloned, clang::Expr*& oldValue, clang::Expr*& R, clang::BinaryOperator::Opcode& opCode) { + DeclRefExpr* RRef = GetUnderlyingDeclRefOrNull(R); // In the case that an RHS expression is a declReference, we do not emit // any error because the assignment operation entials zero error. // However, for compound assignment operators, the RHS may be a // declRefExpr but here we will need to emit its error. // This checks for the above conditions. - if (opCode != BO_Assign || !isa(R->IgnoreImplicit())) + if (opCode != BO_Assign || !RRef) EmitBinaryOpErrorStmts(LCloned, oldValue); }