Skip to content
Draft
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
10 changes: 10 additions & 0 deletions shared/controlflow/codeql/controlflow/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ signature module AstSig<LocationSig Location> {
Stmt getElse();
}

/** Gets the initializer of this `if` statement, if any. */
default AstNode getIfInit(IfStmt ifstmt) { none() }

/**
* A loop statement. Loop statements are further subclassed into specific
* types of loops.
Expand Down Expand Up @@ -1509,6 +1512,13 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
or
exists(IfStmt ifstmt |
n1.isBefore(ifstmt) and
(
n2.isBefore(getIfInit(ifstmt))
or
not exists(getIfInit(ifstmt)) and n2.isBefore(ifstmt.getCondition())
)
or
n1.isAfter(getIfInit(ifstmt)) and
n2.isBefore(ifstmt.getCondition())
or
n1.isAfterTrue(ifstmt.getCondition()) and
Expand Down
Loading