From 310c33a3c2d5331dbf5df418e69403e6220cbf7e Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Wed, 31 Jul 2024 16:11:47 +0000 Subject: [PATCH 1/2] Add a check-not clause to the test --- test/FirstDerivative/FunctionCallsWithResults.C | 1 + 1 file changed, 1 insertion(+) diff --git a/test/FirstDerivative/FunctionCallsWithResults.C b/test/FirstDerivative/FunctionCallsWithResults.C index 91d7d95bd..8eae9e94c 100644 --- a/test/FirstDerivative/FunctionCallsWithResults.C +++ b/test/FirstDerivative/FunctionCallsWithResults.C @@ -1,6 +1,7 @@ // RUN: %cladclang %s -I%S/../../include -oFunctionCallsWithResults.out \ // RUN: -Xclang -verify 2>&1 | %filecheck %s // RUN: ./FunctionCallsWithResults.out | %filecheck_exec %s +//CHECK-NOT: {{.*error|warning|note:.*}} #include "clad/Differentiator/Differentiator.h" #include From a71951271c2a596dd82bd0a6d2875c0d45b41df4 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Wed, 31 Jul 2024 16:32:38 +0000 Subject: [PATCH 2/2] 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 41b174f5c..3e4c000df 100644 --- a/lib/Differentiator/BaseForwardModeVisitor.cpp +++ b/lib/Differentiator/BaseForwardModeVisitor.cpp @@ -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()); auto zero = ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0); return StmtDiff(op, zero); @@ -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()); opDiff = ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0); } if (opDiff) diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 1080788be..032ebb0a4 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -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(); } @@ -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()); }