1
0
mirror of https://github.com/golang/go synced 2024-11-17 20:04:47 -07:00

cmd/compile: allow objStub from unsafe package

CL 346469 added support for unsafe.Sizeof and friends to operate on
generic parameters for compiler importer/exporter. This CL adds support
for unified IR.

Updates #48094

Change-Id: I63af1a7c3478f59b03ecc23229ac2254d3457868
Reviewed-on: https://go-review.googlesource.com/c/go/+/346769
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2021-09-01 19:58:31 +07:00
parent 1bd35fab05
commit 9afbf82667

View File

@ -147,6 +147,10 @@ func (r *reader2) doPkg() *types2.Package {
if path == "builtin" {
return nil // universe
}
if path == "unsafe" {
// TODO(mdempsky): This should be in r.p.imports.
return types2.Unsafe
}
if path == "" {
path = r.p.pkgPath
}
@ -362,7 +366,7 @@ func (pr *pkgReader2) objIdx(idx int) (*types2.Package, string) {
tag := codeObj(rname.code(syncCodeObj))
if tag == objStub {
assert(objPkg == nil)
assert(objPkg == nil || objPkg == types2.Unsafe)
return objPkg, objName
}