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
16 changes: 16 additions & 0 deletions shared/controlflow/codeql/controlflow/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,12 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
query = "missingInNodeForPostOrInOrder" and
results = strictcount(AstNode ast | missingInNodeForPostOrInOrder(ast))
or
query = "invalidAbruptCompletionOrigin" and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: Can we keep the disjunct ordering the same in this predicate as the query predicate ordering below? I.e. for instance move this newly added disjunct up above query = "missingInNodeForPostOrInOrder" since that's where it's at below.

results =
strictcount(AstNode ast, PreControlFlowNode node |
invalidAbruptCompletionOrigin(ast, node)
)
or
query = "multipleSuccessors" and
results =
strictcount(ControlFlowNode node, SuccessorType t, ControlFlowNode successor |
Expand Down Expand Up @@ -2341,6 +2347,16 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
1 < strictcount(NormalSuccessor t | additionalNode(n, tag, t))
}

/**
* Holds if the language-specific CFG input supplies an abrupt completion for `ast` whose
* origin `node` does not belong to `ast`.
*/
query predicate invalidAbruptCompletionOrigin(AstNode ast, PreControlFlowNode node) {
Input2::beginAbruptCompletion(ast, node, _, _) and
not node.isIn(ast) and
not node.isAdditional(ast, _)
}

/**
* Holds if the "in" node is unreachable for a post-or-in-order AST node.
*
Expand Down
Loading