Commit Graph

88235 Commits

Author SHA1 Message Date
Owen Mansel-Chan
2e1289dbdd Test changes to be checked 2026-06-24 19:19:25 +01:00
Owen Mansel-Chan
7bfab958dd Update query for unreachable statements 2026-06-24 19:19:23 +01:00
Owen Mansel-Chan
80bd6117ec Fix calls for defer statements 2026-06-24 19:19:21 +01:00
Owen Mansel-Chan
8fd9c31e81 Go CFG: run deferred calls at function exit in LIFO order
Model `defer`ed calls so the call runs at function exit rather than inline
at the `defer` statement, reproducing the previous control-flow semantics:

- Add a per-defer "defer-invoke" node for the deferred call.
- deferExitStep wires normal-exit predecessors (return nodes and body
  fall-through) through the active deferred-call invocations in
  last-in-first-out order, then on to the normal exit target (the
  result-read epilogue for named results, or the normal exit node).
- The chain is reachability-gated using the defer-free successor relation
  (succIgnoringDeferExit / isInOrderNode), so only deferred calls that were
  actually registered on a path are run on that path.
- overridesCallableBodyExit / overridesCallableEndAbruptCompletion suppress
  the default body-exit and return routing for functions containing
  `defer`, so the epilogue is interposed instead.
2026-06-24 19:19:19 +01:00
Owen Mansel-Chan
5b79e0d20d Shared CFG: add hooks for reachability-gated exit epilogue
Add opt-in InputSig2 predicates to support a function-exit epilogue whose
placement depends on reachability (such as Go's deferred calls, run at
exit in last-in-first-out order):

- deferExitStep: language-provided exit-epilogue edges, wired into
  explicitStep but excluded from the defer-free reachability.
- overridesCallableBodyExit: suppresses the default fall-through edge from
  a body's "after" node to the normal exit, so the epilogue can be
  interposed on fall-through paths.

To let a language compute the reachability gate for those edges without
observing them (and without a non-monotonic cycle through reachable):

- explicitStep is split into explicitStepCommon (defer-free) plus
  deferExitStep, and defaultCfg now negates explicitStepCommon so default
  evaluation does not depend on deferExitStep.
- succIgnoringDeferExit exposes the defer-free successor relation, typed
  over PreControlFlowNode so it does not depend on reachable.
- getASuccessorIgnoringDeferredExit exposes the same relation as a
  ControlFlowNode member for general use.
- isInOrderNode exposes a structural, reachability-free node-identity test
  for use inside the negations a language needs when computing its gate.
- EntryNodeImpl is no longer private, so a language can identify the entry
  node over PreControlFlowNode.

All InputSig2 additions default to none(), leaving other languages
unchanged.
2026-06-24 19:19:17 +01:00
Owen Mansel-Chan
71cc56464b Go CFG: anchor result-read epilogue on Normal Exit via new hooks 2026-06-24 19:19:15 +01:00
Owen Mansel-Chan
ac1b126efd Shared CFG: add callableExitStep hook for routing epilogue tails to exit nodes 2026-06-24 19:19:13 +01:00
Owen Mansel-Chan
0e50b3c00a Allow overriding endAbruptCompletion for callables 2026-06-24 19:19:11 +01:00
Owen Mansel-Chan
b0e886f553 Include implicit type switch var in CFG 2026-06-24 19:19:09 +01:00
Owen Mansel-Chan
9090ed3802 accept test changes 2026-06-24 19:19:07 +01:00
Owen Mansel-Chan
ebe24b26f7 Fix CFG for expressionless switch statements 2026-06-24 19:19:05 +01:00
Owen Mansel-Chan
e5cd376670 Accept changes 2026-06-24 19:19:03 +01:00
Owen Mansel-Chan
4a3fbf3beb Fix ConditionGuardNode 2026-06-24 19:19:01 +01:00
Owen Mansel-Chan
f5b0127bba Accept test output change names 2026-06-24 19:18:59 +01:00
Owen Mansel-Chan
f436d89b3f Restore ConditionGuardNode 2026-06-24 19:18:57 +01:00
Owen Mansel-Chan
c5895a85ce Fix treatment of ParenExpr 2026-06-24 19:18:55 +01:00
Owen Mansel-Chan
85d198ebdf Add Go CFG consistency query 2026-06-24 19:18:53 +01:00
Owen Mansel-Chan
4409d8271c Go: update expected node names 2026-06-24 19:18:51 +01:00
Owen Mansel-Chan
3a955b172f Use shared CFG getIfInit 2026-06-24 19:18:49 +01:00
Owen Mansel-Chan
c4011f16aa Fix lit-init nodes
There was a loop in the definitions which meant nothing ever got made
2026-06-24 19:18:47 +01:00
Owen Mansel-Chan
63464ecb84 Fix range loop CFG 2026-06-24 19:18:45 +01:00
Owen Mansel-Chan
4d627be3a0 update function-entry additional nodes 2026-06-24 19:18:43 +01:00
Owen Mansel-Chan
5962a22bdb Restore ExprNode for FuncLit 2026-06-24 19:18:41 +01:00
Owen Mansel-Chan
7430209c3a Accept change in test output
To determine that test9 can't return normally, you have to use the fact
that test5 can't return normally. This would make CFG construction
recursive, which would be bad for performance. Therefore we accept the
limitation that we cannot detect that test9 can't return normally, and
we change the test output.
2026-06-24 19:18:39 +01:00
Owen Mansel-Chan
dc7867b459 Fix empty switch statements 2026-06-24 19:18:37 +01:00
Owen Mansel-Chan
8c7859929c Control flow shouldn't enter another callable 2026-06-24 19:18:34 +01:00
Owen Mansel-Chan
c1dfeaca9f Fix CFG for return instructions 2026-06-24 19:18:32 +01:00
Owen Mansel-Chan
1bcdbd2d34 Produce CFG nodes for more reference expressions, like selector bases 2026-06-24 19:18:30 +01:00
Owen Mansel-Chan
cffc3c7bec Fix global value numbering calculation 2026-06-24 19:18:28 +01:00
Owen Mansel-Chan
8fb4875021 Include receivers in parameter init 2026-06-24 19:18:26 +01:00
Owen Mansel-Chan
008cbbadcf Fix CFG for range loop 2026-06-24 19:18:24 +01:00
Owen Mansel-Chan
d6d254fdda Fix CFG for select statements 2026-06-24 19:18:22 +01:00
Owen Mansel-Chan
a5e761254e Use shared CFG implementation of for loops 2026-06-24 19:18:20 +01:00
Owen Mansel-Chan
e328a5d69e Do not include comments in the CFG 2026-06-24 19:18:18 +01:00
Owen Mansel-Chan
01568dd2db Fix edges to function exit with result variables 2026-06-24 19:18:16 +01:00
Owen Mansel-Chan
c136d3ec30 Tweak getEnclosingCallable 2026-06-24 19:18:14 +01:00
Owen Mansel-Chan
6a1649d384 Model non-returning functions in CFG 2026-06-24 19:18:12 +01:00
Owen Mansel-Chan
fbd82ffd68 Create cfg node for child of ParenExpr 2026-06-24 19:18:10 +01:00
Owen Mansel-Chan
3937a96ca4 Add go/print-cfg 2026-06-24 19:18:07 +01:00
Owen Mansel-Chan
a26cbad255 Initial shared CFG library instantiation for Go 2026-06-24 19:18:05 +01:00
Owen Mansel-Chan
412f4c2403 Incidental fix to CaseClause.getAnExpr() 2026-06-24 19:18:03 +01:00
copilot-swe-agent[bot]
1e05710256 Initial plan 2026-06-24 19:18:01 +01:00
Anders Schack-Mulligen
bcf71d0db6 Merge pull request #22043 from github/copilot/tweak-ruby-ast-caseexpr
Ruby: synthesize implicit `true` value for valueless `CaseExpr`
2026-06-24 15:43:04 +02:00
Anders Schack-Mulligen
5047bee432 Ruby: Adjust qldoc. 2026-06-24 13:36:54 +02:00
Anders Schack-Mulligen
29eba2f38e Merge pull request #22017 from aschackmull/cfg/catchclause-pattern
Cfg: Change AST/CFG for CatchClauses to use a pattern.
2026-06-24 13:21:54 +02:00
copilot-swe-agent[bot]
4fa8a9fb1d Synthesize true value for valueless Ruby CaseExpr 2026-06-24 10:36:23 +00:00
Michael Nebel
a24d222d96 Merge pull request #22011 from michaelnebel/csharp/removeafallback
C#: Re-factor feed handling logic into its own component.
2026-06-24 11:58:56 +02:00
Anders Schack-Mulligen
bcfee987f0 Apply suggestion from @aschackmull 2026-06-24 10:26:26 +02:00
Anders Schack-Mulligen
e1d4fe8605 C#: Accept test changes. 2026-06-23 14:42:20 +02:00
Anders Schack-Mulligen
11725e8921 Java: Accept test changes. 2026-06-23 14:28:44 +02:00