Files
codeql/python/ql/test/library-tests/ControlFlow/evaluation-order/AllLiveReachable.ql
Taus 710a43ac7f Python: Add some CFG-validation queries
These use the annotated, self-verifying test files to check various
consistency requirements.

Some of these may be expressing the same thing in different ways, but
it's fairly cheap to keep them around, so I have not attempted to
produce a minimal set of queries for this.
2026-05-05 15:21:40 +00:00

18 lines
584 B
Plaintext

/**
* Checks that every live (non-dead) annotation in the test function's
* own scope is reachable from the function entry in the CFG.
* Annotations in nested scopes (generators, async, lambdas, comprehensions)
* have separate CFGs and are excluded from this check.
*/
import python
import TimerUtils
from TimerCfgNode a, TestFunction f
where
not a.isDead() and
f = a.getTestFunction() and
a.getScope() = f and
not f.getEntryNode().getBasicBlock().reaches(a.getBasicBlock())
select a, "Unreachable live annotation; entry of $@ does not reach this node", f, f.getName()