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 Dec 17, 2024
1 parent 310c33a commit a719512
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 @@ -1392,7 +1392,7 @@ StmtDiff BaseForwardModeVisitor::VisitUnaryOperator(const UnaryOperator* UnOp) {
Expr* derivedOp = BuildOp(UO_Minus, diff.getExpr_dx());
return {op, derivedOp};
} else {
unsupportedOpWarn(UnOp->getEndLoc());
unsupportedOpWarn(UnOp->getOperatorLoc());

Check warning on line 1395 in lib/Differentiator/BaseForwardModeVisitor.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Differentiator/BaseForwardModeVisitor.cpp#L1395

Added line #L1395 was not covered by tests
auto zero =
ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0);
return StmtDiff(op, zero);
Expand Down Expand Up @@ -1534,7 +1534,7 @@ BaseForwardModeVisitor::VisitBinaryOperator(const BinaryOperator* BinOp) {
opDiff = BuildOp(opCode, Ldiff.getExpr_dx(), Rdiff.getExpr());
} else {
// FIXME: add support for other binary operators
unsupportedOpWarn(BinOp->getEndLoc());
unsupportedOpWarn(BinOp->getOperatorLoc());

Check warning on line 1537 in lib/Differentiator/BaseForwardModeVisitor.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Differentiator/BaseForwardModeVisitor.cpp#L1537

Added line #L1537 was not covered by tests
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 @@ -2333,7 +2333,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();
}
Expand Down Expand Up @@ -2657,7 +2657,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());

return BuildOp(opCode, Visit(L).getExpr(), Visit(R).getExpr());
}
Expand Down

0 comments on commit a719512

Please sign in to comment.