Skip to content

Commit

Permalink
Don't emit error statements when assigning array sub exprs
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi authored and vgvassilev committed Mar 12, 2024
1 parent 24d2461 commit 55835f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Differentiator/ErrorEstimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DeclRefExpr>(R->IgnoreImplicit()))
if (opCode != BO_Assign || !RRef)
EmitBinaryOpErrorStmts(LCloned, oldValue);
}

Expand Down

0 comments on commit 55835f0

Please sign in to comment.