-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dataflow: Refactor stage 6 to use shared stage code. #17105
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
Conversation
e9b5fda
to
d5cbac4
Compare
d5cbac4
to
0295a25
Compare
0295a25
to
45f2795
Compare
0c69179
to
feace74
Compare
96de3bd
to
525b6f3
Compare
This change actually gets us a tiny precision improvement: Previously, the reachability in |
CPP changes and DCA LGTM (as does Swift DCA). 👍 |
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.
Thanks a lot for making this refactoring, that makes the code much more maintainable.
not this instanceof StagePathNodeSrcGrp and | ||
not this instanceof StagePathNodeSinkGrp |
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.
Alternatively, you could define private class TPathNode = TPathNodeMid or TPathNodeSink
and then add TPathNode
to the extent of PathNode
.
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.
That wouldn't remove the need for a charpred, so I don't think it would gain much - TPathNode
would still be larger than PathNode
.
This extends the StagePathGraph and corresponding nodes to fully match the existing PathGraph and PathNode. With that in place, the existing stage 6 code is replaced by an instantiation of the Stage module to reduce code duplication.
Things to note:
PathNode
in order to avoid unreachable edges, since an edge using reachable nodes might be reverse-reachable from a sink without being forward-reachable.pathStep
predicate, so in order to continue to support this, the check has been pushed into the general stage computation.PathNode
s (thesummaryLabel
), but can instead be computed in a separate predicate. This gets rid of a lot of superfluousPathNode
s (as can be seen in several qltests).pathStep
and the current implementation in the stage modules. The latter includes the call site to determine whether flow-through is possible and hence whether to construct a summary context. For certain cases where a call target can have both flow-through from one call-site and flow-but-not-through from another call-site, this can result in a few additionalPathNode
s. This can be seen in the changes to the C++ qltest expected output.Aggregate
method, which chains its data through two callbacks.Commit-by-commit review is strongly encouraged. I made effort to split the changes into separately reviewable commits.
Fixes https://github.com/github/codeql-team/issues/3234