C++: SSA and range analysis for reference parameters#4162
C++: SSA and range analysis for reference parameters#4162MathiasVP merged 6 commits intogithub:mainfrom
Conversation
- Support inference of guards on reference variables - Support type bounds for reference variables - Support reference variables when widening - Support reference variables when determining arithmetic assignment
|
Started https://jenkins.internal.semmle.com/job/Changes/job/CPP-Differences/1373/. I expect to see a lot of differences on real-world code. |
MathiasVP
left a comment
There was a problem hiding this comment.
I think this LGTM, but I'll wait with the formal approval until we've validated the CPP-difference.
|
The CPP-Differences LGTM. The only changes are three new results from I had expected to see changes in all the queries that use SSA, and I can't really explain why the impact is so small. |
|
I'd be tempted to say that the use of a reference-parameter On balance, I think this change is the least disruptive thing we can do that fixes the range analysis. Queries that want more information about indirections will have to use IR. |
This PR changes the AST-based SSA and RangeSSA libraries to make the same assumption about reference-typed parameters that the IR does: that they don't alias any value that'll be mutated from within the function body.
A further commit, authored by @lcartey, adds support for reference-typed parameters in
SimpleRangeAnalysis.