From 710c1ba05023ae70de9d28c3e79ebf2239b96b77 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Tue, 21 Apr 2026 11:22:46 +0100 Subject: [PATCH] Make `getACallee` overlay[global] Co-authored-by: Copilot --- go/ql/lib/semmle/go/Decls.qll | 3 ++- go/ql/lib/semmle/go/Scopes.qll | 3 ++- go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go/ql/lib/semmle/go/Decls.qll b/go/ql/lib/semmle/go/Decls.qll index 7588ab913bed..f42058cd3e88 100644 --- a/go/ql/lib/semmle/go/Decls.qll +++ b/go/ql/lib/semmle/go/Decls.qll @@ -1,7 +1,7 @@ /** * Provides classes for working with declarations. */ -overlay[local] +overlay[local?] module; import go @@ -137,6 +137,7 @@ class FuncDef extends @funcdef, StmtParent, ExprParent { /** * Gets a call to this function. */ + overlay[global] DataFlow::CallNode getACall() { result.getACallee() = this } /** Holds if this function is variadic. */ diff --git a/go/ql/lib/semmle/go/Scopes.qll b/go/ql/lib/semmle/go/Scopes.qll index 4e9a13c8ea1f..9f18290fb011 100644 --- a/go/ql/lib/semmle/go/Scopes.qll +++ b/go/ql/lib/semmle/go/Scopes.qll @@ -1,7 +1,7 @@ /** * Provides classes for working with scopes and declared objects. */ -overlay[local] +overlay[local?] module; import go @@ -418,6 +418,7 @@ class Function extends ValueEntity, @functionobject { * This includes calls that target this function indirectly, by calling an * interface method that this function implements. */ + overlay[global] pragma[nomagic] DataFlow::CallNode getACall() { this = result.getACalleeIncludingExternals().asFunction() } diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll index 8fca4bec8c63..603da6364df7 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll @@ -1,4 +1,4 @@ -overlay[local] +overlay[local?] module; private import go @@ -488,6 +488,7 @@ module Public { * For virtual calls, we look up possible targets in all types that implement the receiver * interface type. */ + overlay[global] Callable getACalleeIncludingExternals() { result = this.getACalleeWithoutVirtualDispatch() or @@ -504,6 +505,7 @@ module Public { * As `getACalleeIncludingExternals`, except excluding external functions (those for which * we lack a definition, such as standard library functions). */ + overlay[global] pragma[nomagic] FuncDef getACallee() { result = this.getACalleeIncludingExternals().getFuncDef() }