From fc7b75f21622a3c4ddb523f49a24274ffcf41147 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9my=20Oudompheng?= Date: Wed, 30 Jan 2013 21:10:19 +0100 Subject: [PATCH] cmd/gc: fix export data for aggressive inlining. Export data was broken after revision 6b602ab487d6 when -l is specified at least 3 times: it makes the compiler write out func (*T).Method() declarations in export data, which is not supported. Also fix the formatting of recover() in export data. It was not treated like panic() and was rendered as "". R=golang-dev, lvd, minux.ma, rsc CC=golang-dev https://golang.org/cl/7067051 --- src/cmd/gc/export.c | 11 ++++++++++- src/cmd/gc/fmt.c | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cmd/gc/export.c b/src/cmd/gc/export.c index b235f676cd..6cbd5c8fff 100644 --- a/src/cmd/gc/export.c +++ b/src/cmd/gc/export.c @@ -106,12 +106,19 @@ reexportdep(Node *n) switch(n->class&~PHEAP) { case PFUNC: // methods will be printed along with their type + // nodes for T.Method expressions if(n->left && n->left->op == OTYPE) break; + // nodes for method calls. + if(!n->type || n->type->thistuple > 0) + break; // fallthrough case PEXTERN: - if(n->sym && !exportedsym(n->sym)) + if(n->sym && !exportedsym(n->sym)) { + if(debug['E']) + print("reexport name %S\n", n->sym); exportlist = list(exportlist, n); + } } break; @@ -122,6 +129,8 @@ reexportdep(Node *n) if(isptr[t->etype]) t = t->type; if(t && t->sym && t->sym->def && !exportedsym(t->sym)) { + if(debug['E']) + print("reexport type %S from declaration\n", t->sym); exportlist = list(exportlist, t->sym->def); } } diff --git a/src/cmd/gc/fmt.c b/src/cmd/gc/fmt.c index 3ff212ea33..ce6ee729bd 100644 --- a/src/cmd/gc/fmt.c +++ b/src/cmd/gc/fmt.c @@ -228,6 +228,7 @@ goopnames[] = [ORANGE] = "range", [OREAL] = "real", [ORECV] = "<-", + [ORECOVER] = "recover", [ORETURN] = "return", [ORSH] = ">>", [OSELECT] = "select", @@ -1290,6 +1291,7 @@ exprfmt(Fmt *f, Node *n, int prec) case OMAKE: case ONEW: case OPANIC: + case ORECOVER: case OPRINT: case OPRINTN: if(n->left) -- 2.48.1