Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class StmtCfgNode extends AstCfgNode {
Stmt getStmt() { result = s }
}

pragma[nomagic]
private BasicBlock getARelevantBasicBlock(Ast a) { result.getANode().getAstNode() = a }

/**
* A class for mapping parent-child AST nodes to parent-child CFG nodes.
*/
Expand All @@ -86,7 +89,7 @@ abstract private class ChildMapping extends Ast {
or
exists(BasicBlock mid |
this.reachesBasicBlock(child, cfn, mid) and
not mid.getANode().getAstNode() = child
not mid = getARelevantBasicBlock(child)
|
if this.precedesParent(child) then bb = mid.getAPredecessor() else bb = mid.getASuccessor()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,11 +1083,8 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
)
or
// Read from a collection into a `foreach` loop
exists(
CfgNodes::StmtNodes::ForEachStmtCfgNode forEach, Content::KnownElementContent ec, BasicBlock bb,
int i
|
c.isKnownOrUnknownElement(ec) and
c.isAnyPositional() and
exists(CfgNodes::StmtNodes::ForEachStmtCfgNode forEach, BasicBlock bb, int i |
node1.asExpr() = forEach.getIterableExpr() and
bb.getNode(i) = forEach.getVarAccess() and
node2.asDefinition().definesAt(_, bb, i)
Expand Down
Loading