]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/dwarfgen: use src.Pos.Rel{Filename,Line,Col} consistently
authorMatthew Dempsky <mdempsky@google.com>
Wed, 18 Aug 2021 21:42:12 +0000 (14:42 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 18 Aug 2021 23:19:19 +0000 (23:19 +0000)
It appears that this code predates golang.org/cl/96535, which added
RelCol to support /*line*/ directives.

Change-Id: Ib79cebc1be53af706e84e8799eeea81ef8c81c8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/343430
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/dwarfgen/dwarf.go
src/cmd/compile/internal/dwarfgen/dwinl.go

index 0e22b61bc3ff4344ba1ad7c3e74f65c76a620243..30472a9ebd750ead59dc5131737b7301ce378405 100644 (file)
@@ -214,7 +214,7 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
                        Type:          base.Ctxt.Lookup(typename),
                        DeclFile:      declpos.RelFilename(),
                        DeclLine:      declpos.RelLine(),
-                       DeclCol:       declpos.Col(),
+                       DeclCol:       declpos.RelCol(),
                        InlIndex:      int32(inlIndex),
                        ChildIndex:    -1,
                })
@@ -371,7 +371,7 @@ func createSimpleVar(fnsym *obj.LSym, n *ir.Name) *dwarf.Var {
                Type:          base.Ctxt.Lookup(typename),
                DeclFile:      declpos.RelFilename(),
                DeclLine:      declpos.RelLine(),
-               DeclCol:       declpos.Col(),
+               DeclCol:       declpos.RelCol(),
                InlIndex:      int32(inlIndex),
                ChildIndex:    -1,
        }
@@ -475,7 +475,7 @@ func createComplexVar(fnsym *obj.LSym, fn *ir.Func, varID ssa.VarID) *dwarf.Var
                StackOffset: ssagen.StackOffset(debug.Slots[debug.VarSlots[varID][0]]),
                DeclFile:    declpos.RelFilename(),
                DeclLine:    declpos.RelLine(),
-               DeclCol:     declpos.Col(),
+               DeclCol:     declpos.RelCol(),
                InlIndex:    int32(inlIndex),
                ChildIndex:  -1,
        }
index 8adb36fc883da0614f760410fa8f6af8e7ccb25e..c785e064a7f48497b2f4304848efe5879c65cd33 100644 (file)
@@ -244,7 +244,7 @@ func makePreinlineDclMap(fnsym *obj.LSym) map[varPos]int {
                        DeclName: unversion(n.Sym().Name),
                        DeclFile: pos.RelFilename(),
                        DeclLine: pos.RelLine(),
-                       DeclCol:  pos.Col(),
+                       DeclCol:  pos.RelCol(),
                }
                if _, found := m[vp]; found {
                        // We can see collisions (variables with the same name/file/line/col) in obfuscated or machine-generated code -- see issue 44378 for an example. Skip duplicates in such cases, since it is unlikely that a human will be debugging such code.