diff --git a/shared/controlflow/codeql/controlflow/Cfg.qll b/shared/controlflow/codeql/controlflow/Cfg.qll index 7f1eb54b2b02..576e7b2ba208 100644 --- a/shared/controlflow/codeql/controlflow/Cfg.qll +++ b/shared/controlflow/codeql/controlflow/Cfg.qll @@ -1395,5 +1395,15 @@ module Make Input> { /** Holds if CFG scope `scope` lacks an initial AST node. */ query predicate scopeNoFirst(CfgScope scope) { not scopeFirst(scope, _) } + + /** Holds if `node` is appears in `first` but not in `succ`. */ + query predicate firstNoSucc(AstNode node) { + first(_, node) and not succ(node, _, _) and not succ(_, node, _) + } + + /** Holds if `node` is appears in `first` but not in `succ`. */ + query predicate lastNoSucc(AstNode node) { + last(_, node, _) and not succ(node, _, _) and not succ(_, node, _) + } } }