diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-10-29 18:44:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-10-29 18:44:39 +0000 |
commit | 943cc2fb6463ab8e06c2f2bcc4281a65e9dc4a78 (patch) | |
tree | d33e568cab7d6f7f5dc3e5d6efa7dbd3ebdb4b6f /gcc/go/go-linemap.cc | |
parent | 266ef3613ea80da937a9fc782eb5c3ae8dcabb8f (diff) | |
download | gcc-943cc2fb6463ab8e06c2f2bcc4281a65e9dc4a78.zip gcc-943cc2fb6463ab8e06c2f2bcc4281a65e9dc4a78.tar.gz gcc-943cc2fb6463ab8e06c2f2bcc4281a65e9dc4a78.tar.bz2 |
compiler: add location_file
Add support for getting the file name from a Location value. This
will be used by later work.
Reviewed-on: https://go-review.googlesource.com/c/145318
* go-linemap.cc (Gcc_linemap::location_file): New method.
From-SVN: r265598
Diffstat (limited to 'gcc/go/go-linemap.cc')
-rw-r--r-- | gcc/go/go-linemap.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/go/go-linemap.cc b/gcc/go/go-linemap.cc index 2accb95..a4d4b7d 100644 --- a/gcc/go/go-linemap.cc +++ b/gcc/go/go-linemap.cc @@ -34,6 +34,9 @@ class Gcc_linemap : public Linemap std::string to_string(Location); + std::string + location_file(Location); + int location_line(Location); @@ -93,7 +96,16 @@ Gcc_linemap::to_string(Location location) return ss.str(); } -// Return the line number for a given location (for debugging dumps) +// Return the file name for a given location. + +std::string +Gcc_linemap::location_file(Location loc) +{ + return LOCATION_FILE(loc.gcc_location()); +} + +// Return the line number for a given location. + int Gcc_linemap::location_line(Location loc) { |