tools/internal
Alan Donovan bfc94c967a go/ssa: extract type recursion into a helper package
This change moves ssa.forEachReachable into
internal/typesinternal.ForEachElement, simplifies
the signature (by internalizing the type map part)
and adds a test.

There are two copies of this algorithm (the other in
go/callgraph/rta), and we will need it again in
ssautil.Reachable (see golang/go#69291).
A follow-up change will make the copy in rta delegate
to this one (small steps).

Also, make ssa.Program.RuntimeTypes do the type analysis
when it is called, instead of doing it eagerly each time
we encounter a MakeInterface instruction.
This should reduce eventually costs since RuntimeTypes
shouldn't be needed: it was added for the pointer analysis
(since deleted) and it used by ssautil.AllFunctions (to
be replaced, see golang/go#69291), and in both cases it
is the wrong tool for the job because:

(a) it is more precise to accumulate runtime types in
    the subset of the program of interest, while doing
    some kind of reachability fixed-point computation;
    and

(b) its use in AllFunctions is unsound because although
    it accounts for all (too many!) MakeInterface operations
    it does not account for types exposed through public
    API (see the proposed replacement, ssautil.Reachable)
    when analyzing incomplete programs.

Updates golang/go#69291

Change-Id: Ib369278e50295b9287fe95c06169b81425193e90
Reviewed-on: https://go-review.googlesource.com/c/tools/+/610939
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-09 20:13:36 +00:00
..
aliases internal/aliases: add type parameters argument to NewAliases 2024-08-22 22:34:20 +00:00
analysisinternal go/analysis/passes/stringintconv: do not generate empty edits 2024-06-25 14:23:44 +00:00
apidiff all: fix some typos in comments 2024-04-22 15:08:19 +00:00
astutil gopls/internal/lsp: add code actions to remove unused parameters 2023-10-16 14:27:29 +00:00
bisect internal/bisect: fix doc comment api links 2024-07-17 21:42:50 +00:00
diff all: fix some typos in comments 2024-04-22 15:08:19 +00:00
diffp internal/diffp: add patience diff from main repo 2023-05-05 00:46:00 +00:00
drivertest internal/testfiles: consolidate to CopyToTmp 2024-07-26 21:44:58 +00:00
edit internal/edit: copy cmd/internal/edit 2023-07-31 12:54:44 +00:00
event gopls: normalize logging attributes 2024-04-26 20:08:17 +00:00
facts all: fix some typos in comments 2024-04-22 15:08:19 +00:00
fakenet
gcimporter internal/gcimporter: copy over ureader changes 2024-09-03 21:06:05 +00:00
gocommand gopls/internal/golang: improve ergonomics of "Browse documentation" 2024-06-18 16:21:21 +00:00
gopathwalk internal/gopathwalk: walk directories concurrently 2024-02-06 18:40:19 +00:00
goroot internal/gcimporter: load cached export data for packages individually 2022-12-02 18:23:46 +00:00
imports internal/imports: use a clean GOMODCACHE for the scan root directory 2024-08-13 17:53:00 +00:00
jsonrpc2 gopls: normalize logging attributes 2024-04-26 20:08:17 +00:00
jsonrpc2_v2 gopls: normalize logging attributes 2024-04-26 20:08:17 +00:00
memoize internal/memoize: fix race in Store.Promise 2022-07-28 15:35:11 +00:00
packagesinternal internal/packagesinternal: delete GoCmdRunner var (unused) 2023-11-08 22:30:59 +00:00
pkgbits internal/pkgbits: cleanup pre-Go 1.17 workaround 2024-08-30 22:00:18 +00:00
pprof internal/pprof: a function to compute total pprof time 2023-07-06 20:34:16 +00:00
proxydir tools: replace references to obsolete package ioutils 2023-09-12 20:13:37 +00:00
refactor/inline x/tools: deprecate astutil.Unparen 2024-09-09 18:20:00 +00:00
robustio x/tools: drop go1.18 support 2024-02-29 16:54:26 +00:00
stack
stdlib internal/stdlib: update stdlib index for Go 1.23.0 2024-08-13 17:00:02 +00:00
testenv internal/aliases: expose Enabled 2024-04-23 20:27:57 +00:00
testfiles internal/testfiles: adjust test so all modules are after 1.21 2024-08-13 17:11:19 +00:00
tokeninternal x/tools: drop go1.18 support 2024-02-29 16:54:26 +00:00
tool all: fix some symbols error in comment 2024-09-09 14:44:08 +00:00
typeparams internal/typeparams: fix crash in interface hover with empty type set 2024-06-27 18:14:51 +00:00
typesinternal go/ssa: extract type recursion into a helper package 2024-09-09 20:13:36 +00:00
versions internal/versions: disable a test case incompatible with CL 607955 2024-08-27 21:22:16 +00:00
xcontext