Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for null (empty) statements #900

Merged
merged 1 commit into from
May 21, 2024

Conversation

gojakuch
Copy link
Collaborator

This commit removes the "unsupported" warning when differentiating code with ";" in both forward and reverse modes. It also prevents additional semicolons from getting pulled into the derivative code.

Fixes: #899

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.09%. Comparing base (4126fa7) to head (0cf0e47).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #900      +/-   ##
==========================================
- Coverage   94.15%   94.09%   -0.07%     
==========================================
  Files          53       53              
  Lines        7803     7805       +2     
==========================================
- Hits         7347     7344       -3     
- Misses        456      461       +5     
Files Coverage Δ
...clude/clad/Differentiator/BaseForwardModeVisitor.h 100.00% <100.00%> (ø)
include/clad/Differentiator/ReverseModeVisitor.h 97.89% <100.00%> (+0.02%) ⬆️

... and 2 files with indirect coverage changes

Files Coverage Δ
...clude/clad/Differentiator/BaseForwardModeVisitor.h 100.00% <100.00%> (ø)
include/clad/Differentiator/ReverseModeVisitor.h 97.89% <100.00%> (+0.02%) ⬆️

... and 2 files with indirect coverage changes

@vgvassilev
Copy link
Owner

Can you break the long commit message lines at 80-columns? This has been somewhat standard.

Copy link
Owner

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming the commit message is addressed.

@@ -109,6 +109,7 @@ class BaseForwardModeVisitor
const clang::SubstNonTypeTemplateParmExpr* NTTP);
StmtDiff VisitImplicitValueInitExpr(const clang::ImplicitValueInitExpr* IVIE);
StmtDiff VisitCStyleCastExpr(const clang::CStyleCastExpr* CSCE);
StmtDiff VisitNullStmt(const clang::NullStmt* NS) { return StmtDiff{}; };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect there is a lot of such cases for the different types of statements. Maybe you can take a look at the statements we do not have a Visit routine for. Some of them could be as trivial and easy to test. That'd increase the coverage of supported things generally speaking.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, I'll look for things like this

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

This commit removes the "unsupported" warning when differentiating
 code with ";" in both forward and reverse modes. It also prevents
additional semicolons from getting pulled into the derivative code.

Fixes: vgvassilev#899
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Owner

Codecov complains because now the NullStmts have their own routine and we do not fall back into VisitStmt (which generally should never happen).

@vgvassilev vgvassilev merged commit d629553 into vgvassilev:master May 21, 2024
88 of 89 checks passed
@gojakuch gojakuch deleted the issue-899 branch May 21, 2024 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for differentiating the null (empty) statement ;
2 participants