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 Aug 22, 2024
1 parent 434bac5 commit 6098ac6
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 @@ -1389,7 +1389,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 1392 in lib/Differentiator/BaseForwardModeVisitor.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Differentiator/BaseForwardModeVisitor.cpp#L1392

Added line #L1392 was not covered by tests
auto zero =
ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0);
return StmtDiff(op, zero);
Expand Down Expand Up @@ -1529,7 +1529,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 1532 in lib/Differentiator/BaseForwardModeVisitor.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Differentiator/BaseForwardModeVisitor.cpp#L1532

Added line #L1532 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 @@ -2269,7 +2269,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 @@ -2676,7 +2676,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 6098ac6

Please sign in to comment.