Skip to content

Commit

Permalink
Produce more accurate diagnostic of what's not supported yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Jul 31, 2024
1 parent 2b2207c commit cb36983
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Differentiator/BaseForwardModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Check warning on line 2119 in lib/Differentiator/ReverseModeVisitor.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Differentiator/ReverseModeVisitor.cpp#L2119

Added line #L2119 was not covered by tests
diff = Visit(E);
ResultRef = diff.getExpr_dx();
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cb36983

Please sign in to comment.