Skip to content

Commit

Permalink
Add support for sizeof
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi authored and vgvassilev committed Aug 23, 2024
1 parent e0087a9 commit 6280e8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/clad/Differentiator/ReverseModeVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ namespace clad {
virtual StmtDiff VisitReturnStmt(const clang::ReturnStmt* RS);
StmtDiff VisitStmt(const clang::Stmt* S);
virtual StmtDiff VisitUnaryOperator(const clang::UnaryOperator* UnOp);
StmtDiff
VisitUnaryExprOrTypeTraitExpr(const clang::UnaryExprOrTypeTraitExpr* UE);
StmtDiff VisitExprWithCleanups(const clang::ExprWithCleanups* EWC);
/// Decl is not Stmt, so it cannot be visited directly.
StmtDiff VisitWhileStmt(const clang::WhileStmt* WS);
Expand Down
5 changes: 5 additions & 0 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4107,6 +4107,11 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
return Visit(NTTP->getReplacement());
}

StmtDiff ReverseModeVisitor::VisitUnaryExprOrTypeTraitExpr(
const clang::UnaryExprOrTypeTraitExpr* UE) {
return {Clone(UE), Clone(UE)};
}

DeclDiff<StaticAssertDecl> ReverseModeVisitor::DifferentiateStaticAssertDecl(
const clang::StaticAssertDecl* SAD) {
return DeclDiff<StaticAssertDecl>(nullptr, nullptr);
Expand Down

0 comments on commit 6280e8d

Please sign in to comment.