From e8708268da50b5015083673af41913edbb0555f1 Mon Sep 17 00:00:00 2001 From: Atell Krasnopolski Date: Mon, 9 Dec 2024 18:51:31 +0100 Subject: [PATCH] some inverstigations --- lib/Differentiator/ReverseModeVisitor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 3f6fe8144..c2a4be348 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -1555,9 +1555,9 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, // diffedOpCall->getTrailingRequiresClause() ); - // Cloned->addDecl(ClonedOpCall); // do we need this? + Cloned->addDecl(ClonedOpCall); - auto* diffedOpCall = DifferentiateCallOperatorIfLambda(Original, ClonedOpCall); + // auto* diffedOpCall = DifferentiateCallOperatorIfLambda(Original, ClonedOpCall); // llvm::SmallVector params; // for (unsigned i = 0; i < diffedOpCall->param_size(); ++i) { @@ -1592,7 +1592,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, } StmtDiff ReverseModeVisitor::VisitLambdaExpr(const clang::LambdaExpr* LE) { - // ============== CAP + // ============== CAPTURES auto children_iterator_range = LE->children(); std::vector children_Exp; @@ -1633,7 +1633,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, llvm::ArrayRef childrenRef_Exp_dx; // = // clad_compat::makeArrayRef(children_Exp_dx.data(), children_Exp_dx.size()); - // ============== CAP + // ============== CAPTURES // FIXME: ideally, we need to create a reverse_forw lambda and not copy the original one for the forward pass. auto forwardLambdaClass = LE->getLambdaClass(); @@ -2310,7 +2310,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, // FIXME: Add support for reference arguments to the numerical diff. If // it already correctly support reference arguments then confirm the // support and add tests for the same. - if (!pullbackFD && !utils::HasAnyReferenceOrPointerArgument(FD) && + if (!pullbackFD && !utils::HasAnyReferenceOrPointerArgument(FD) && !isa(FD)) { // Try numerically deriving it. if (NArgs == 1) {