From cb3698398d45c44cf409901a925be9d316fd363e Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Wed, 31 Jul 2024 16:32:38 +0000 Subject: [PATCH] Produce more accurate diagnostic of what's not supported yet. --- lib/Differentiator/BaseForwardModeVisitor.cpp | 4 ++-- lib/Differentiator/ReverseModeVisitor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Differentiator/BaseForwardModeVisitor.cpp b/lib/Differentiator/BaseForwardModeVisitor.cpp index 4135c6972..4171571ab 100644 --- a/lib/Differentiator/BaseForwardModeVisitor.cpp +++ b/lib/Differentiator/BaseForwardModeVisitor.cpp @@ -1383,7 +1383,7 @@ StmtDiff BaseForwardModeVisitor::VisitUnaryOperator(const UnaryOperator* UnOp) { } else if (opKind == UnaryOperatorKind::UO_LNot) { return StmtDiff(op, diff.getExpr_dx()); } else { - unsupportedOpWarn(UnOp->getEndLoc()); + unsupportedOpWarn(UnOp->getOperatorLoc()); auto zero = ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0); return StmtDiff(op, zero); @@ -1518,7 +1518,7 @@ BaseForwardModeVisitor::VisitBinaryOperator(const BinaryOperator* BinOp) { return StmtDiff(opDiff, nullptr); } else { // FIXME: add support for other binary operators - unsupportedOpWarn(BinOp->getEndLoc()); + unsupportedOpWarn(BinOp->getOperatorLoc()); opDiff = ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0); } if (opDiff) diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index f95f2c60f..5536c692b 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -2116,7 +2116,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, // discontinuity in the function space. // FIXME: We should support boolean differentiation or ignore it // completely - unsupportedOpWarn(UnOp->getEndLoc()); + unsupportedOpWarn(UnOp->getOperatorLoc()); diff = Visit(E); ResultRef = diff.getExpr_dx(); } @@ -2515,7 +2515,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, // FIXME: We should support boolean differentiation or ignore it // completely if (!BinOp->isComparisonOp() && !BinOp->isLogicalOp()) - unsupportedOpWarn(BinOp->getEndLoc()); + unsupportedOpWarn(BinOp->getOperatorLoc()); // If either LHS or RHS is a declaration reference, visit it to avoid // naming collision