mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Make getACallee return DataFlowCallable
This commit is contained in:
committed by
Owen Mansel-Chan
parent
8cba368ef5
commit
4af4a11729
@@ -135,7 +135,7 @@ class FuncDef extends @funcdef, StmtParent, ExprParent {
|
||||
/**
|
||||
* Gets a call to this function.
|
||||
*/
|
||||
DataFlow::CallNode getACall() { result.getACallee() = this }
|
||||
DataFlow::CallNode getACall() { result.getACallee().getFuncDef() = this }
|
||||
|
||||
/** Holds if this function is variadic. */
|
||||
predicate isVariadic() { this.getType().isVariadic() }
|
||||
|
||||
@@ -371,7 +371,7 @@ class Function extends ValueEntity, @functionobject {
|
||||
DataFlow::CallNode getACall() {
|
||||
this = result.getTarget()
|
||||
or
|
||||
this.(DeclaredFunction).getFuncDecl() = result.getACallee()
|
||||
this = result.getACallee().asFunction()
|
||||
}
|
||||
|
||||
/** Gets the declaration of this function, if any. */
|
||||
|
||||
@@ -91,7 +91,7 @@ DataFlowCallable viableCallable(CallExpr ma) {
|
||||
else
|
||||
if isInterfaceMethodCall(call)
|
||||
then result = getRestrictedInterfaceTarget(call)
|
||||
else result.getFuncDef() = call.getACallee()
|
||||
else result = call.getACallee()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ module Public {
|
||||
ControlFlow::Root getRoot() { none() } // overridden in subclasses
|
||||
|
||||
/** INTERNAL: Use `getRoot()` instead. */
|
||||
FuncDef getEnclosingCallable() { result = this.getRoot() }
|
||||
DataFlowCallable getEnclosingCallable() { result.getFuncDef() = this.getRoot() }
|
||||
|
||||
/** Gets the type of this node. */
|
||||
Type getType() { none() } // overridden in subclasses
|
||||
@@ -430,16 +430,16 @@ module Public {
|
||||
* For virtual calls, we look up possible targets in all types that implement the receiver
|
||||
* interface type.
|
||||
*/
|
||||
FuncDef getACallee() {
|
||||
result = this.getTarget().(DeclaredFunction).getFuncDecl()
|
||||
DataFlowCallable getACallee() {
|
||||
result.asFunction() = this.getTarget()
|
||||
or
|
||||
exists(DataFlow::Node calleeSource | calleeSource = this.getACalleeSource() |
|
||||
result = calleeSource.asExpr()
|
||||
result.asFuncLit() = calleeSource.asExpr()
|
||||
or
|
||||
exists(Method declared, Method actual |
|
||||
calleeSource = declared.getARead() and
|
||||
actual.implements(declared) and
|
||||
result = actual.(DeclaredFunction).getFuncDecl()
|
||||
result.asFunction() = actual
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -518,8 +518,6 @@ module Public {
|
||||
MethodCallNode() { expr.getTarget() instanceof Method }
|
||||
|
||||
override Method getTarget() { result = expr.getTarget() }
|
||||
|
||||
override MethodDecl getACallee() { result = super.getACallee() }
|
||||
}
|
||||
|
||||
/** A representation of a parameter initialization. */
|
||||
|
||||
Reference in New Issue
Block a user