aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-10-18 23:22:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-10-18 23:22:01 +0000
commitdbf9376f9ed37bc98218adde4e17d6ee34701179 (patch)
treeae9ca18100b4d161827eb0d62c561c73d7e8625b /libgo
parent442d4185084653cec6922fc87f9a8c1b96e4b87d (diff)
downloadgcc-dbf9376f9ed37bc98218adde4e17d6ee34701179.zip
gcc-dbf9376f9ed37bc98218adde4e17d6ee34701179.tar.gz
gcc-dbf9376f9ed37bc98218adde4e17d6ee34701179.tar.bz2
compiler: list indirect imports separately in export data
Previously when export data referred to a type that was not defined in a directly imported package, we would write the package name as additional information in the type's export data. That approach required all type information to be read in order. This patch changes the compiler to find all references to indirectly imported packages, and write them out as an indirectimport line in the import data. This will permit us to read exported type data out of order. The type traversal used to find indirect imports is a little more complicated than necessary in preparation for later patches in this series. Reviewed-on: https://go-review.googlesource.com/c/143020 From-SVN: r265296
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/go/internal/gccgoimporter/parser.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libgo/go/go/internal/gccgoimporter/parser.go b/libgo/go/go/internal/gccgoimporter/parser.go
index 5988c5d..cd4e1d9 100644
--- a/libgo/go/go/internal/gccgoimporter/parser.go
+++ b/libgo/go/go/internal/gccgoimporter/parser.go
@@ -832,6 +832,7 @@ func (p *parser) parseInitDataDirective() {
// "pkgpath" unquotedString ";" |
// "prefix" unquotedString ";" |
// "import" unquotedString unquotedString string ";" |
+// "indirectimport" unquotedString unquotedstring ";" |
// "func" Func ";" |
// "type" Type ";" |
// "var" Var ";" |
@@ -875,6 +876,13 @@ func (p *parser) parseDirective() {
p.parseString()
p.expectEOL()
+ case "indirectimport":
+ p.next()
+ pkgname := p.parseUnquotedString()
+ pkgpath := p.parseUnquotedString()
+ p.getPkg(pkgpath, pkgname)
+ p.expectEOL()
+
case "func":
p.next()
fun := p.parseFunc(p.pkg)