From c570041032aa761014fea1d4c1da68921bf3c1e0 Mon Sep 17 00:00:00 2001 From: "petro.zarytskyi" Date: Mon, 5 Aug 2024 16:59:02 +0300 Subject: [PATCH] Support CXXScalarValueInitExpr --- include/clad/Differentiator/BaseForwardModeVisitor.h | 2 ++ lib/Differentiator/BaseForwardModeVisitor.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/clad/Differentiator/BaseForwardModeVisitor.h b/include/clad/Differentiator/BaseForwardModeVisitor.h index 3de507d69..fa7c09ad6 100644 --- a/include/clad/Differentiator/BaseForwardModeVisitor.h +++ b/include/clad/Differentiator/BaseForwardModeVisitor.h @@ -102,6 +102,8 @@ class BaseForwardModeVisitor StmtDiff VisitCXXThisExpr(const clang::CXXThisExpr* CTE); StmtDiff VisitCXXNewExpr(const clang::CXXNewExpr* CNE); StmtDiff VisitCXXDeleteExpr(const clang::CXXDeleteExpr* CDE); + StmtDiff + VisitCXXScalarValueInitExpr(const clang::CXXScalarValueInitExpr* SVIE); StmtDiff VisitCXXStaticCastExpr(const clang::CXXStaticCastExpr* CSE); StmtDiff VisitCXXFunctionalCastExpr(const clang::CXXFunctionalCastExpr* FCE); StmtDiff VisitCXXBindTemporaryExpr(const clang::CXXBindTemporaryExpr* BTE); diff --git a/lib/Differentiator/BaseForwardModeVisitor.cpp b/lib/Differentiator/BaseForwardModeVisitor.cpp index bf8782f44..c53757261 100644 --- a/lib/Differentiator/BaseForwardModeVisitor.cpp +++ b/lib/Differentiator/BaseForwardModeVisitor.cpp @@ -2283,6 +2283,11 @@ StmtDiff BaseForwardModeVisitor::VisitCXXStdInitializerListExpr( return Visit(ILE->getSubExpr()); } +StmtDiff BaseForwardModeVisitor::VisitCXXScalarValueInitExpr( + const CXXScalarValueInitExpr* SVIE) { + return {Clone(SVIE), Clone(SVIE)}; +} + clang::Expr* BaseForwardModeVisitor::BuildCustomDerivativeConstructorPFCall( const clang::CXXConstructExpr* CE, llvm::SmallVectorImpl& clonedArgs,