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
C++: Use an IPA type rather than negative indexes for argument/parameter matching in data flow #7541
base: main
Are you sure you want to change the base?
Conversation
This takes advantage of the new ArgumentPosition and ParameterPosition types in the shared DataFlow library interface to represent indirections with an IPA type rather than the negative-index system in use previously
Only a couple of minor comments. I think we should run a DCA for this as well before we merge it.
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
Outdated
Show resolved
Hide resolved
| @@ -11,6 +11,7 @@ private import semmle.code.cpp.ir.IR | |||
| private import semmle.code.cpp.controlflow.IRGuards | |||
| private import semmle.code.cpp.models.interfaces.DataFlow | |||
| private import DataFlowPrivate | |||
| private import DataFlowDispatch | |||
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.
Why do we need to import DataFlowDispatch here?
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.
I think I added that before moving the ArgumentPosition definitions out of DataFlowDispatch. It's not needed any more.
| /** An argument position represented by an integer. */ | ||
| class ArgumentPosition = Position; | ||
|
|
||
| class Position extends TPosition { |
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.
Should we add an INTERNAL: Do not use QLDoc to this?
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.
Good point, but I think I can move it to DataFlowPrivate, actually.
| } | ||
|
|
||
| newtype TPosition = | ||
| TDirectPosition(int index) { exists(any(CallInstruction c).getArgument(index))} or | ||
| TIndirectionPosition(int index) { exists(any(CallInstruction c).getArgument(index)) } |
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.
Should this branch be restricted to those CallInstructions that have a ReadSideEffectInstruction at index index?
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.
Probably. I'll just check ReadSideEffectInstruction::getIndex(), though.
No description provided.
The text was updated successfully, but these errors were encountered: