mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Python: Remove points-to to from ControlFlowNode
Moves the existing points-to predicates to the newly added class `ControlFlowNodeWithPointsTo` which resides in the `LegacyPointsTo` module. (Existing code that uses these predicates should import this module, and references to `ControlFlowNode` should be changed to `ControlFlowNodeWithPointsTo`.) Also updates all existing points-to based code to do just this.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ControlFlowNode f, Object o, ControlFlowNode x
|
||||
from ControlFlowNodeWithPointsTo f, Object o, ControlFlowNode x
|
||||
where f.refersTo(o, x)
|
||||
select f.getLocation().getStartLine(), f.toString(), o.toString(), x.getLocation().getStartLine()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ControlFlowNode f, Object o, ClassObject c, ControlFlowNode x
|
||||
from ControlFlowNodeWithPointsTo f, Object o, ClassObject c, ControlFlowNode x
|
||||
where f.refersTo(o, c, x)
|
||||
select f.getLocation().getStartLine(), f.toString(), o.toString(), c.toString(),
|
||||
x.getLocation().getStartLine()
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ClassValue cls, string res
|
||||
where
|
||||
exists(CallNode call |
|
||||
call.getFunction().(NameNode).getId() = "test" and
|
||||
call.getAnArg().pointsTo(cls)
|
||||
call.getAnArg().(ControlFlowNodeWithPointsTo).pointsTo(cls)
|
||||
) and
|
||||
(
|
||||
cls.isSequence() and
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from int line, ControlFlowNode f, Object o, ControlFlowNode orig
|
||||
from int line, ControlFlowNodeWithPointsTo f, Object o, ControlFlowNode orig
|
||||
where
|
||||
not f.getLocation().getFile().inStdlib() and
|
||||
f.refersTo(o, orig) and
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from int line, ControlFlowNode f, Object o, ClassObject cls, ControlFlowNode orig
|
||||
from int line, ControlFlowNodeWithPointsTo f, Object o, ClassObject cls, ControlFlowNode orig
|
||||
where
|
||||
not f.getLocation().getFile().inStdlib() and
|
||||
f.refersTo(o, cls, orig) and
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ControlFlowNode f, Context ctx, Value v, ControlFlowNode origin
|
||||
from ControlFlowNodeWithPointsTo f, Context ctx, Value v, ControlFlowNode origin
|
||||
where
|
||||
f.pointsTo(ctx, v, origin) and
|
||||
f.getLocation().getFile().getBaseName() = "test.py"
|
||||
|
||||
Reference in New Issue
Block a user