aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types/size.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-08-26 15:54:44 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-08-27 00:36:54 +0000
commit62f88b6dc8782cedf1a945e4992abda3bc0ad67d (patch)
treed84b0d4774ba942b548cff9a93d196ff162d9467 /src/cmd/compile/internal/types/size.go
parente7eee5e265440b0ed3b76093ccdfd776facc767a (diff)
downloadgo-62f88b6dc8782cedf1a945e4992abda3bc0ad67d.tar.gz
go-62f88b6dc8782cedf1a945e4992abda3bc0ad67d.zip
cmd/compile: add types.RecalcSize
This is the only case where Align is assigned outside of package types. Rather than adding a SetAlign method, adding a RecalcSize function is a bit more descriptive. Change-Id: I1b3c01ebd0e41183665baa63c926592865bbbd0b Reviewed-on: https://go-review.googlesource.com/c/go/+/345479 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types/size.go')
-rw-r--r--src/cmd/compile/internal/types/size.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go
index 34db0a0b0c..2546f0e2d1 100644
--- a/src/cmd/compile/internal/types/size.go
+++ b/src/cmd/compile/internal/types/size.go
@@ -562,6 +562,14 @@ func CalcStructSize(s *Type) {
s.Width = calcStructOffset(s, s, 0, 1) // sets align
}
+// RecalcSize is like CalcSize, but recalculates t's size even if it
+// has already been calculated before. It does not recalculate other
+// types.
+func RecalcSize(t *Type) {
+ t.Align = 0
+ CalcSize(t)
+}
+
// when a type's width should be known, we call CheckSize
// to compute it. during a declaration like
//