]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: refactor container()
authorHiroshi Ioka <hirochachacha@gmail.com>
Mon, 28 Aug 2017 06:00:49 +0000 (15:00 +0900)
committerIan Lance Taylor <iant@golang.org>
Wed, 30 Aug 2017 01:07:31 +0000 (01:07 +0000)
* rename to emitPcln because I'd like to skip not only container types,
  but also something like "go.buildid" in the future.
* return bool instead of int.

Change-Id: I029adb81292f7dd2fe98e69f3877c5c27f32ec30
Reviewed-on: https://go-review.googlesource.com/59415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

src/cmd/link/internal/ld/pcln.go

index 1f6aed3f712487b9c6429dc5ff721004afea3d0f..b21ffe8bed758b58a86ee51503e507398ecf9c36 100644 (file)
@@ -171,19 +171,19 @@ func onlycsymbol(s *Symbol) bool {
        return false
 }
 
-func container(s *Symbol) int {
+func emitPcln(s *Symbol) bool {
        if s == nil {
-               return 0
+               return true
        }
        if Buildmode == BuildmodePlugin && Headtype == objabi.Hdarwin && onlycsymbol(s) {
-               return 1
+               return false
        }
        // We want to generate func table entries only for the "lowest level" symbols,
        // not containers of subsymbols.
        if s.Type&SCONTAINER != 0 {
-               return 1
+               return false
        }
-       return 0
+       return true
 }
 
 // pclntab initializes the pclntab symbol with
@@ -220,7 +220,7 @@ func (ctxt *Link) pclntab() {
        }
 
        for _, s := range ctxt.Textp {
-               if container(s) == 0 {
+               if emitPcln(s) {
                        nfunc++
                }
        }
@@ -247,7 +247,7 @@ func (ctxt *Link) pclntab() {
        var last *Symbol
        for _, s := range ctxt.Textp {
                last = s
-               if container(s) != 0 {
+               if !emitPcln(s) {
                        continue
                }
                pcln := s.FuncInfo
@@ -464,7 +464,7 @@ func (ctxt *Link) findfunctab() {
        }
        idx := int32(0)
        for i, s := range ctxt.Textp {
-               if container(s) != 0 {
+               if !emitPcln(s) {
                        continue
                }
                p := s.Value
@@ -473,7 +473,7 @@ func (ctxt *Link) findfunctab() {
                if i < len(ctxt.Textp) {
                        e = ctxt.Textp[i]
                }
-               for container(e) != 0 && i < len(ctxt.Textp) {
+               for !emitPcln(e) && i < len(ctxt.Textp) {
                        e = ctxt.Textp[i]
                        i++
                }