Skip to content

Commit

Permalink
gopls/internal/lsp/cache: avoid dependency on StdSizes
Browse files Browse the repository at this point in the history
Same as CL 516917, but for gopls.

Updates golang/go#61035

Change-Id: Id6cc1d84f7cac06e95a1fb151a7c3f9a8ef25302
Reviewed-on: https://go-review.googlesource.com/c/tools/+/519295
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
cuonglm authored and gopherbot committed Aug 15, 2023
1 parent fa12f34 commit 74c255b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions gopls/internal/lsp/cache/analysis.go
Expand Up @@ -707,10 +707,9 @@ func (an *analysisNode) cacheKey() [sha256.Size]byte {
// uses those fields, we account for them by hashing vdeps.

// type sizes
// This assertion is safe, but if a black-box implementation
// is ever needed, record Sizeof(*int) and Alignof(int64).
sz := m.TypesSizes.(*types.StdSizes)
fmt.Fprintf(hasher, "sizes: %d %d\n", sz.WordSize, sz.MaxAlign)
wordSize := an.m.TypesSizes.Sizeof(types.Typ[types.Int])
maxAlign := an.m.TypesSizes.Alignof(types.NewPointer(types.Typ[types.Int64]))
fmt.Fprintf(hasher, "sizes: %d %d\n", wordSize, maxAlign)

// metadata errors: used for 'compiles' field
fmt.Fprintf(hasher, "errors: %d", len(m.Errors))
Expand Down
5 changes: 3 additions & 2 deletions gopls/internal/lsp/cache/check.go
Expand Up @@ -1401,8 +1401,9 @@ func localPackageKey(inputs typeCheckInputs) source.Hash {
}

// types sizes
sz := inputs.sizes.(*types.StdSizes)
fmt.Fprintf(hasher, "sizes: %d %d\n", sz.WordSize, sz.MaxAlign)
wordSize := inputs.sizes.Sizeof(types.Typ[types.Int])
maxAlign := inputs.sizes.Alignof(types.NewPointer(types.Typ[types.Int64]))
fmt.Fprintf(hasher, "sizes: %d %d\n", wordSize, maxAlign)

fmt.Fprintf(hasher, "relatedInformation: %t\n", inputs.relatedInformation)
fmt.Fprintf(hasher, "linkTarget: %s\n", inputs.linkTarget)
Expand Down

0 comments on commit 74c255b

Please sign in to comment.