-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Rust: Add local data flow edge for SSA nodes #18026
Conversation
( | ||
LocalFlow::localFlowStepCommon(nodeFrom, nodeTo) | ||
or | ||
SsaFlow::localFlowStep(_, nodeFrom, nodeTo, _) |
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.
This should be part of localFlowStepCommon
.
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've moved it. I copied the pattern from Ruby where it's also structured st. the SSA flow is not in localFlowStepCommon
.
// An edge from a pattern to its corresponding SSA definition. | ||
nodeFrom.(Node::PatNode).getPat() = | ||
nodeTo.(Node::SsaNode).getDefinitionExt().getSourceVariable().getPat() |
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 rather be:
// An edge from a pattern/expression to its corresponding SSA definition.
nodeFrom.(Node::AstCfgFlowNode).getCfgNode() =
nodeTo.(Node::SsaNode).getDefinitionExt().(Ssa::WriteDefinition).getControlFlowNode()
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 🙇. That makes sense.
@@ -112,7 +112,7 @@ | |||
} | |||
|
|||
/** A data flow node that corresponds to a CFG node for an AST node. */ | |||
abstract private class AstCfgFlowNode extends Node { | |||
abstract class AstCfgFlowNode extends Node { |
Check warning
Code scanning / CodeQL
UnusedField Warning
field n
ParameterNode
This class declares the
Adds some additional local data flow tests and fixes a few missing results by adding an edge from patterns to their corresponding SSA node.
I'm not 100% that this is the correct thing to do in all cases (complex patterns) but it did fix the tests, and we can iterate on this.