-
Notifications
You must be signed in to change notification settings - Fork 122
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
Fix call expr to functor inside a function #626
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #626 +/- ##
==========================================
+ Coverage 94.03% 94.04% +0.01%
==========================================
Files 43 43
Lines 6218 6230 +12
==========================================
+ Hits 5847 5859 +12
Misses 371 371
|
800bcce
to
9286fdc
Compare
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -1412,12 +1413,20 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, | |||
// statements there later. | |||
std::size_t insertionPoint = getCurrentBlock(direction::reverse).size(); | |||
|
|||
// `CXXOperatorCallExpr` have the `base` expression as the first argument. | |||
size_t skipFirstArg = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the late review.
What is the main issue if we do not skip the first arg? I suppose it might be required if we modify the functor's member variables in the call operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first arg in the operator call is the base expression which is not needed in calling the pullback function, I used the logic of skipping the first arg from this in forward mode: https://github.com/vgvassilev/clad/blob/master/lib/Differentiator/BaseForwardModeVisitor.cpp#L980
This fixes #625 for the case when a functor is indirectly differentiated because of a call expression inside a function.