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,7 +248,14 @@ module PointsToBasedCallGraph {
xmlCallee = this.getXMLCallee() and xmlCallee = this.getXMLCallee() and
( (
xmlCallee instanceof XMLPythonCallee and xmlCallee instanceof XMLPythonCallee and
calleeValue.(PythonFunctionValue).getScope() = xmlCallee.(XMLPythonCallee).getACallee() (
// 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 or
xmlCallee instanceof XMLExternalCallee and xmlCallee instanceof XMLExternalCallee and
calleeValue.(BuiltinFunctionObjectInternal).getBuiltin() = calleeValue.(BuiltinFunctionObjectInternal).getBuiltin() =