From ca2a886cbade477e2c7cf09cdac604b757fb70a9 Mon Sep 17 00:00:00 2001 From: griesemer Date: Fri, 10 Nov 2017 11:38:51 -0800 Subject: cmd/compile: record original and absolute file names for line directives Also, with this change, error locations don't print absolute positions in [] brackets following positions relative to line directives. To get the absolute positions as well, specify the -L flag. Fixes #22660. Change-Id: I9ecfa254f053defba9c802222874155fa12fee2c Reviewed-on: https://go-review.googlesource.com/77090 Reviewed-by: David Crawshaw Reviewed-by: Russ Cox --- src/cmd/asm/internal/lex/input.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/cmd/asm') diff --git a/src/cmd/asm/internal/lex/input.go b/src/cmd/asm/internal/lex/input.go index ddfcddf36d..666611e179 100644 --- a/src/cmd/asm/internal/lex/input.go +++ b/src/cmd/asm/internal/lex/input.go @@ -13,6 +13,7 @@ import ( "text/scanner" "cmd/asm/internal/flags" + "cmd/internal/objabi" "cmd/internal/src" ) @@ -454,7 +455,7 @@ func (in *Input) line() { in.Error("unexpected token at end of #line: ", tok) } pos := src.MakePos(in.Base(), uint(in.Line()), uint(in.Col())) - in.Stack.SetBase(src.NewLinePragmaBase(pos, file, uint(line))) + in.Stack.SetBase(src.NewLinePragmaBase(pos, file, objabi.AbsFile(objabi.WorkingDir(), file, *flags.TrimPath), uint(line))) } // #undef processing -- cgit v1.3