Add support for SourceLocExpr - #1929
Conversation
| DECLARE_CLONE_FN(CXXCatchStmt) | ||
| DECLARE_CLONE_FN(CXXTryStmt) | ||
| DECLARE_CLONE_FN(PredefinedExpr) | ||
| DECLARE_CLONE_FN(SourceLocExpr) |
There was a problem hiding this comment.
warning: no header providing "clang::SourceLocExpr" is directly included [misc-include-cleaner]
DECLARE_CLONE_FN(SourceLocExpr)
^
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
We need a test. |
e890f82 to
56b1ca8
Compare
Done! |
| StmtDiff VisitWhileStmt(const clang::WhileStmt* WS); | ||
| StmtDiff VisitDoStmt(const clang::DoStmt* DS); | ||
| StmtDiff VisitContinueStmt(const clang::ContinueStmt* ContStmt); | ||
| StmtDiff VisitSourceLocExpr(const clang::SourceLocExpr* E); |
There was a problem hiding this comment.
warning: no header providing "clang::SourceLocExpr" is directly included [misc-include-cleaner]
StmtDiff VisitSourceLocExpr(const clang::SourceLocExpr* E);
^| clad_compat::ExprSetDeps(result, Node); | ||
| return result; | ||
| } | ||
| #if CLANG_VERSION_MAJOR >= 15 |
There was a problem hiding this comment.
warning: no header providing "CLANG_VERSION_MAJOR" is directly included [misc-include-cleaner]
lib/Differentiator/StmtClone.cpp:17:
+ #include <clang/Basic/Version.h>| return result; | ||
| } | ||
| #if CLANG_VERSION_MAJOR >= 15 | ||
| DEFINE_CLONE_EXPR(SourceLocExpr, |
There was a problem hiding this comment.
warning: initializing non-owner 'SourceLocExpr *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
DEFINE_CLONE_EXPR(SourceLocExpr,
^Additional context
lib/Differentiator/StmtClone.cpp:38: expanded from macro 'DEFINE_CLONE_EXPR'
CLASS* result = new (Ctx) CLASS CTORARGS; \
^56b1ca8 to
812ec46
Compare
| for (unsigned i = 0, e = CE->getNumArgs(); i < e; ++i) { | ||
| for (unsigned i = 0, e = diffArgs.size(); i < e; ++i) { | ||
| Expr* dArg = diffArgs[i]; | ||
| // If argDiff.expr_dx is nullptr or is a constant 0, then the derivative |
There was a problem hiding this comment.
warning: use range-based for loop instead [modernize-loop-convert]
| // If argDiff.expr_dx is nullptr or is a constant 0, then the derivative | |
| for (auto dArg : diffArgs) { | |
| // If argDiff.expr_dx is nullptr or is a constant 0, then the derivative |
167a65e to
e75e0af
Compare
…ontaining assert and other source-location builtins.
e75e0af to
c37b38f
Compare
This PR extends Clad's AST visitor to support SourceLocExpr, enabling differentiation of code containing assert statements and other source-location builtins for both forward and reverse mode.