Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 5 additions & 7 deletions swift/ql/lib/codeql/swift/dataflow/Ssa.qll
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,23 @@ module Ssa {

cached
ControlFlowNode getAFirstRead() {
exists(SsaInput::BasicBlock bb1, int i1, SsaInput::BasicBlock bb2, int i2 |
this.definesAt(_, bb1, i1) and
SsaImpl::adjacentDefRead(this, bb1, i1, bb2, i2) and
result = bb2.getNode(i2)
exists(SsaInput::BasicBlock bb, int i |
SsaImpl::firstUse(this, bb, i, true) and
result = bb.getNode(i)
)
}

cached
predicate adjacentReadPair(ControlFlowNode read1, ControlFlowNode read2) {
exists(SsaInput::BasicBlock bb1, int i1, SsaInput::BasicBlock bb2, int i2 |
read1 = bb1.getNode(i1) and
SsaInput::variableRead(bb1, i1, _, true) and
SsaImpl::adjacentDefRead(this, bb1, i1, bb2, i2) and
SsaImpl::adjacentUseUse(bb1, i1, bb2, i2, _, true) and
read2 = bb2.getNode(i2)
)
}

cached
predicate lastRefRedef(SsaInput::BasicBlock bb, int i, Definition next) {
deprecated predicate lastRefRedef(SsaInput::BasicBlock bb, int i, Definition next) {
SsaImpl::lastRefRedef(this, bb, i, next)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ private class CaptureNodeImpl extends CaptureNode, NodeImpl {
}

private predicate localFlowSsaInput(Node nodeFrom, Ssa::Definition def, Ssa::Definition next) {
exists(BasicBlock bb, int i | def.lastRefRedef(bb, i, next) |
def.definesAt(_, bb, i) and
def = nodeFrom.asDefinition()
)
next.(Ssa::PhiDefinition).getAPhiInput() = def and
def = nodeFrom.asDefinition()
}

/** A collection of cached types and predicates to be evaluated in the same stage. */
Expand Down
Loading