Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go/ql/consistency-queries/TempSsaConsistency.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import go
import semmle.go.dataflow.SsaImpl
import TempConsistency
import TempDataFlowIntegration::DfConsistency
1 change: 1 addition & 0 deletions go/ql/consistency-queries/VariableCaptureConsistency.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import semmle.go.dataflow.internal.VariableCapture::Flow::ConsistencyChecks
5 changes: 5 additions & 0 deletions go/ql/lib/change-notes/2026-10-21-variable-capture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: minorAnalysis
---
* Data flow through captured variables now uses the shared variable capture library, keeping captures associated with their closure objects rather than using context-insensitive jumps, and synchronizing captured variables for deferred closures at deferred invocation while preserving registration-time argument evaluation.
* `DataFlow::ArgumentNode` now includes the closure argument at position `-2` for calls through function values.
4 changes: 4 additions & 0 deletions go/ql/lib/change-notes/2026-11-26-receiver-nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: breaking
---
* `DataFlow::ReceiverNode` now extends `DataFlow::ParameterNode` rather than `DataFlow::SsaParameterNode`, so receiver lookup also works for receivers that are unused or read only inside closures. Queries that need SSA-specific methods must narrow the node to `DataFlow::SsaParameterNode`.
4 changes: 4 additions & 0 deletions go/ql/lib/change-notes/2026-11-28-defer-temporaries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Improved control-flow, IR, SSA, and data-flow modeling of `defer` statements by saving evaluated callees, receivers, and arguments into synthetic temporaries at `defer` registration, reading them before deferred invocation, and saving unnamed `return` values across deferred calls. Mutations performed by deferred calls on arguments and receivers now propagate to function results and subsequent deferred calls in LIFO order rather than appearing in the function body before the `defer` runs. As a result, `CallNode.getArgument`, `CallNode.getSyntacticArgument`, `CallNode.getCalleeNode`, `MethodCallNode.getReceiver`, and `ResultNode` in functions containing `defer` may now return synthetic `InstructionNode`s rather than `ExprNode`s.
14 changes: 13 additions & 1 deletion go/ql/lib/semmle/go/Expr.qll
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,16 @@ class ConversionExpr extends CallOrConversionExpr {
override string getAPrimaryQlClass() { result = "ConversionExpr" }
}

private Expr unwrapCalleeExpr(Expr e) {
result = unwrapCalleeExpr(e.(ParenExpr).getExpr())
or
result = unwrapCalleeExpr(e.(GenericFunctionInstantiationExpr).getBase())
or
not e instanceof ParenExpr and
not e instanceof GenericFunctionInstantiationExpr and
result = e
}

/**
* A function call expression.
*
Expand Down Expand Up @@ -923,8 +933,10 @@ class CallExpr extends CallOrConversionExpr {
*/
SignatureType getCalleeType() { result = this.getCalleeExpr().getType() }

private Expr getUnwrappedCalleeExpr() { result = unwrapCalleeExpr(this.getChildExpr(0)) }

/** Gets the declared target of this call. */
Function getTarget() { this.getCalleeExpr() = result.getAReference() }
Function getTarget() { this.getUnwrappedCalleeExpr() = result.getAReference() }

/** Holds if this call has an ellipsis after its last argument. */
predicate hasEllipsis() { has_ellipsis(this) }
Expand Down
Loading
Loading