diff options
author | Ayke van Laethem <[email protected]> | 2024-07-09 17:26:08 +0200 |
---|---|---|
committer | Ayke <[email protected]> | 2024-07-13 13:26:26 +0200 |
commit | b04b690842f837aedc6d8187bb4a4200b0cc6acc (patch) | |
tree | 731f7e7fe3b1af44905f6388f0c77934f6186624 | |
parent | 8a357af3d81b86ada93a91fbd3b57d9c5fb34fc6 (diff) | |
download | tinygo-b04b690842f837aedc6d8187bb4a4200b0cc6acc.tar.gz tinygo-b04b690842f837aedc6d8187bb4a4200b0cc6acc.zip |
libclang: do not make error locations relative
This is done at a later time anyway, so doesn't need to be done in the
cgo package. In fact, _not_ doing it there makes it easier to print
correct relative packages.
-rw-r--r-- | cgo/libclang.go | 7 | ||||
-rw-r--r-- | testdata/errors/cgo.go | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/cgo/libclang.go b/cgo/libclang.go index ee77611e6..59236bad4 100644 --- a/cgo/libclang.go +++ b/cgo/libclang.go @@ -646,13 +646,6 @@ func (p *cgoPackage) addErrorAfter(pos token.Pos, after, msg string) { // addErrorAt is a utility function to add an error to the list of errors. func (p *cgoPackage) addErrorAt(position token.Position, msg string) { - if filepath.IsAbs(position.Filename) { - // Relative paths for readability, like other Go parser errors. - relpath, err := filepath.Rel(p.currentDir, position.Filename) - if err == nil { - position.Filename = relpath - } - } p.errors = append(p.errors, scanner.Error{ Pos: position, Msg: msg, diff --git a/testdata/errors/cgo.go b/testdata/errors/cgo.go index e0853cc85..ce18278a9 100644 --- a/testdata/errors/cgo.go +++ b/testdata/errors/cgo.go @@ -7,9 +7,6 @@ import "C" func main() { } -// TODO: this error should be relative to the current directory (so cgo.go -// instead of testdata/errors/cgo.go). - // ERROR: # command-line-arguments -// ERROR: testdata/errors/cgo.go:3:5: error: hello -// ERROR: testdata/errors/cgo.go:4:4: error: expected identifier or '(' +// ERROR: cgo.go:3:5: error: hello +// ERROR: cgo.go:4:4: error: expected identifier or '(' |