Add tests for cross-function analysis #59
Merged
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 PR is intended as a precursor to #57 to reduce the diff.)
This PR adds tests for cross-function analysis. It covers the basic functionality of determining what a function does with its arguments, i.e. 1. do they reach a sink, 2. what return values do they reach. It also covers cycles in the call graph, as well as calls to functions from imported packages.
A
want
comment such as this:Means that we expect a
Fact
to be attached to theSinkWrapper
function. TheFact
says that this is a generic function whose first (0th) argument reaches a sink and does not reach any of its return values, while its second argument does not reach a sink, but it does reach the function's first (0th) return value.The following are not covered:
fmt.Fprintf(w, Source{})
(I think for a first stab at cross-function analysis, handling those is out of scope.)