C++: Data flow through reference parameters#2063
Merged
rdmarsh2 merged 4 commits intogithub:masterfrom Oct 22, 2019
Merged
Conversation
rdmarsh2
reviewed
Oct 2, 2019
| } | ||
|
|
||
| /** INTERNAL: do not use. The final value of a non-const ref parameter. */ | ||
| class RefParameterFinalValueNode extends Node, TRefParameterFinalValueNode { |
Contributor
There was a problem hiding this comment.
Could this go in DataFlowPrivate.qll?
Contributor
Author
There was a problem hiding this comment.
Not without some restructuring. The name TRefParameterFinalValueNode is not
available outside this file.
geoffw0
reviewed
Oct 3, 2019
Contributor
geoffw0
left a comment
There was a problem hiding this comment.
LGTM, a few questions / suggestions.
cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll
Outdated
Show resolved
Hide resolved
Contributor
|
@rdmarsh2 I'm happy with this PR now. Please merge it if you are as well. |
Contributor
|
I think the test failures are a semantic conflict with #1735 |
Contributor
Author
|
This also conflicts with #2088, hopefully in a good way. |
This merges github#1735 into this branch to resolve the semantic merge conflicts between them.
…meter I've accepted the new test output, which shows that this branch fixes two false negatives in the test cases from github#2088.
Contributor
Author
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is for a customer who reported to @AlexTereshenkov that we weren't finding all the expected flow in their project. I tested performance on the snapshot from that customer, and it looked fine.
The mechanism used to add this flow is similar to what C# does for
refandoutparameters. The main difference is that C# has explicit data-flow nodes for SSA assignments and reuses those to hold the final assigned value of an output parameter, whereas for C++ I had to addRefParameterFinalValueNodefor this purpose.This work could in principle be generalized to support pointer-typed output parameters, but that's more risky wrt. performance and false positives.
The new tests show some false positives, but none of them are related to the QL changes in this PR.