Skip to content
Merged
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
20 changes: 20 additions & 0 deletions shared/controlflow/codeql/controlflow/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -2090,6 +2090,12 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
module Consistency {
/** Holds if the consistency query `query` has `results` results. */
query predicate consistencyOverview(string query, int results) {
query = "siblingsWithSameIndexInDefaultCfg" and
results =
strictcount(AstNode parent, AstNode child1, AstNode child2, int i |
siblingsWithSameIndexInDefaultCfg(parent, child1, child2, i)
)
or
query = "deadEnd" and results = strictcount(ControlFlowNode node | deadEnd(node))
or
query = "nonUniqueEnclosingCallable" and
Expand Down Expand Up @@ -2135,6 +2141,20 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
results = strictcount(ControlFlowNode node, SuccessorType t | selfLoop(node, t))
}

/**
* Holds if `parent` uses default left-to-right control flow and has
* two different children `child1` and `child2` at the same index
* `i`.
*/
Comment thread
aschackmull marked this conversation as resolved.
query predicate siblingsWithSameIndexInDefaultCfg(
AstNode parent, AstNode child1, AstNode child2, int i
) {
defaultCfg(parent) and
getChild(parent, i) = child1 and
getChild(parent, i) = child2 and
child1 != child2
}

/**
* Holds if `node` is lacking a successor.
*
Expand Down
Loading