Python: deprecate AstNode.getAFlowNode() and rewrite internal callers

Preparatory refactor for the shared-CFG dataflow migration.

Deprecates the AstNode.getAFlowNode() cached predicate on the public
Python QL API and rewrites all ~140 internal callers across lib/, src/,
test/, and tools/ from `expr.getAFlowNode() = cfgNode` to
`cfgNode.getNode() = expr`, using ControlFlowNode.getNode() which
already exists in Flow.qll.

The predicate itself is preserved (with a deprecation note pointing at
the new pattern) so external users do not experience churn — they can
migrate at their own pace and the AST/CFG hierarchies still get the
intended untangling once the deprecation eventually elapses.

Semantic noop verified by:
- All 361 lib/ + src/ queries compile clean.
- All 122 ControlFlow + PointsTo library-tests pass.
- All 64 dataflow library-tests pass.
- All 113 Variables/Exceptions/Expressions/Statements/Functions/Imports/
  Security/CWE-798/ModificationOfParameterWithDefault query-tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot
2026-06-01 10:53:39 +00:00
committed by yoff
parent ac5fa629ef
commit a13dfaa44f
68 changed files with 274 additions and 198 deletions

View File

@@ -238,9 +238,10 @@ module PointsToBasedCallGraph {
Value calleeValue;
ResolvableRecordedCall() {
exists(Call call, XmlCallee xmlCallee |
exists(Call call, XmlCallee xmlCallee, ControlFlowNode callCfg |
call = this.getACall() and
calleeValue.getACall() = call.getAFlowNode() and
callCfg.getNode() = call and
calleeValue.getACall() = callCfg and
xmlCallee = this.getXmlCallee() and
(
xmlCallee instanceof XmlPythonCallee and