Commit 10d14b63 authored by Rémy Oudompheng's avatar Rémy Oudompheng

cmd/gc: prevent ngotype from allocating.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6904061
parent 45fe306a
......@@ -1211,6 +1211,7 @@ void dumptypestructs(void);
Type* methodfunc(Type *f, Type*);
Node* typename(Type *t);
Sym* typesym(Type *t);
Sym* typenamesym(Type *t);
Sym* tracksym(Type *t);
Sym* typesymprefix(char *prefix, Type *t);
int haspointers(Type *t);
......
......@@ -652,8 +652,8 @@ typesymprefix(char *prefix, Type *t)
return s;
}
Node*
typename(Type *t)
Sym*
typenamesym(Type *t)
{
Sym *s;
Node *n;
......@@ -674,7 +674,16 @@ typename(Type *t)
signatlist = list(signatlist, typenod(t));
}
return s->def->sym;
}
Node*
typename(Type *t)
{
Sym *s;
Node *n;
s = typenamesym(t);
n = nod(OADDR, s->def, N);
n->type = ptrto(s->def->type);
n->addable = 1;
......
......@@ -3517,7 +3517,7 @@ ngotype(Node *n)
{
if(n->sym != S && n->realtype != T)
if(strncmp(n->sym->name, "autotmp_", 8) != 0)
return typename(n->realtype)->left->sym;
return typenamesym(n->realtype);
return S;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment