Python: CG trace: handle class instantiation properly in points-to

This commit is contained in:
Rasmus Wriedt Larsen
2020-07-24 11:19:11 +02:00
parent 3ead2e3dc7
commit 367a49803b

View File

@@ -248,8 +248,15 @@ module PointsToBasedCallGraph {
xmlCallee = this.getXMLCallee() and
(
xmlCallee instanceof XMLPythonCallee and
(
// normal function
calleeValue.(PythonFunctionValue).getScope() = xmlCallee.(XMLPythonCallee).getACallee()
or
// class instantiation -- points-to says the call goes to the class
calleeValue.(ClassValue).lookup("__init__").(PythonFunctionValue).getScope() =
xmlCallee.(XMLPythonCallee).getACallee()
)
or
xmlCallee instanceof XMLExternalCallee and
calleeValue.(BuiltinFunctionObjectInternal).getBuiltin() =
xmlCallee.(XMLExternalCallee).getACallee()