mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Introduce DataFlow::Node.getBasicBlock() and use it.
This commit is contained in:
@@ -27,7 +27,7 @@ where
|
||||
cond.ensuresNeq(lenA, const) or
|
||||
cond.ensuresLeq(const, lenA, _)
|
||||
) and
|
||||
cond.dominates(idx.asInstruction().getBasicBlock()) and
|
||||
cond.dominates(idx.getBasicBlock()) and
|
||||
// and that check happens inside the loop body
|
||||
cond.getCondition().getParent+() = fs.getBody()
|
||||
select cond.getCondition(),
|
||||
|
||||
@@ -66,7 +66,7 @@ predicate elementRead(
|
||||
) {
|
||||
ea.reads(array.getAUse(), getAUse(index)) and
|
||||
not array.getType().getUnderlyingType() instanceof MapType and
|
||||
bb = ea.asInstruction().getBasicBlock()
|
||||
bb = ea.getBasicBlock()
|
||||
}
|
||||
|
||||
predicate isRegexpMethodCall(DataFlow::MethodCallNode c) {
|
||||
|
||||
@@ -40,6 +40,9 @@ class Node extends TNode {
|
||||
/** Gets a textual representation of the kind of this data-flow node. */
|
||||
string getNodeKind() { none() } // overridden in subclasses
|
||||
|
||||
/** Gets the basic block to which this data-flow node belongs, if any. */
|
||||
BasicBlock getBasicBlock() { result = asInstruction().getBasicBlock() }
|
||||
|
||||
/** Gets a textual representation of this element. */
|
||||
string toString() { result = "data-flow node" } // overridden in subclasses
|
||||
|
||||
@@ -752,7 +755,7 @@ abstract class BarrierGuard extends Node {
|
||||
result = var.getAUse()
|
||||
|
|
||||
guards(guard, nd, var) and
|
||||
guard.dominates(result.asInstruction().getBasicBlock())
|
||||
guard.dominates(result.getBasicBlock())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -807,7 +810,7 @@ abstract class BarrierGuard extends Node {
|
||||
guards(guard, arg) and
|
||||
localFlow(inp.getExitNode(fd), arg) and
|
||||
ret = outp.getEntryNode(fd) and
|
||||
guard.dominates(ret.asInstruction().getBasicBlock())
|
||||
guard.dominates(ret.getBasicBlock())
|
||||
|
|
||||
exists(boolean b |
|
||||
onlyPossibleReturnOfBool(fd, outp, ret, b) and
|
||||
|
||||
Reference in New Issue
Block a user