]> Cypherpunks repositories - gostls13.git/commitdiff
gc: more accurate line numbers for ATEXT
authorRuss Cox <rsc@golang.org>
Thu, 9 Sep 2010 21:11:51 +0000 (17:11 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 9 Sep 2010 21:11:51 +0000 (17:11 -0400)
and other begin and end of function code

R=ken2
CC=golang-dev
https://golang.org/cl/2158044

src/cmd/5g/ggen.c
src/cmd/6g/ggen.c
src/cmd/8g/ggen.c
src/cmd/gc/go.y

index 328d3284da23d8d5211bcb45d544c092940aceba..c906064584e27b380b9d7773e3a4c947c4accd20 100644 (file)
@@ -61,6 +61,8 @@ compile(Node *fn)
 
        pl = newplist();
        pl->name = curfn->nname;
+       
+       setlineno(curfn);
 
        nodconst(&nod1, types[TINT32], 0);
        ptxt = gins(ATEXT, curfn->nname, &nod1);
@@ -93,6 +95,8 @@ compile(Node *fn)
                genlist(curfn->exit);
        if(nerrors != 0)
                goto ret;
+       if(curfn->endlineno)
+               lineno = curfn->endlineno;
        pc->as = ARET;  // overwrite AEND
        pc->lineno = lineno;
 
index f0aa16cb429eb92e5ea04416b6bb2f45101e861c..6d005d7ece38cdb11d3a73a864874514a3c2b4d4 100644 (file)
@@ -62,6 +62,8 @@ compile(Node *fn)
        pl = newplist();
        pl->name = curfn->nname;
 
+       setlineno(curfn);
+
        nodconst(&nod1, types[TINT32], 0);
        ptxt = gins(ATEXT, curfn->nname, &nod1);
        afunclit(&ptxt->from);
@@ -83,6 +85,8 @@ compile(Node *fn)
        checklabels();
        if(nerrors != 0)
                goto ret;
+       if(curfn->endlineno)
+               lineno = curfn->endlineno;
 
        if(curfn->type->outtuple != 0)
                ginscall(throwreturn, 0);
index 5c51833ea20e5f7cbf6bec593f829e74aae64e91..0c3a8260c2bc001f332899d49d86a6ac388c6911 100644 (file)
@@ -64,6 +64,8 @@ compile(Node *fn)
        pl = newplist();
        pl->name = curfn->nname;
 
+       setlineno(curfn);
+
        nodconst(&nod1, types[TINT32], 0);
        ptxt = gins(ATEXT, curfn->nname, &nod1);
        afunclit(&ptxt->from);
@@ -85,6 +87,8 @@ compile(Node *fn)
        checklabels();
        if(nerrors != 0)
                goto ret;
+       if(curfn->endlineno)
+               lineno = curfn->endlineno;
 
        if(curfn->type->outtuple != 0)
                ginscall(throwreturn, 0);
index 48b8c711e1e3170c3b38d57ec486bdbda7027322..e210fbd2cd315770ad8d313ee5fd1fb0068ae30f 100644 (file)
@@ -1100,6 +1100,7 @@ xfndcl:
                if($$ == N)
                        break;
                $$->nbody = $3;
+               $$->endlineno = lineno;
                funcbody($$);
        }