aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/go-linemap.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-10-29 18:44:39 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-10-29 18:44:39 +0000
commit943cc2fb6463ab8e06c2f2bcc4281a65e9dc4a78 (patch)
treed33e568cab7d6f7f5dc3e5d6efa7dbd3ebdb4b6f /gcc/go/gofrontend/go-linemap.h
parent266ef3613ea80da937a9fc782eb5c3ae8dcabb8f (diff)
downloadgcc-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/gofrontend/go-linemap.h')
-rw-r--r--gcc/go/gofrontend/go-linemap.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/go-linemap.h b/gcc/go/gofrontend/go-linemap.h
index 704efdb..1811c9d 100644
--- a/gcc/go/gofrontend/go-linemap.h
+++ b/gcc/go/gofrontend/go-linemap.h
@@ -63,7 +63,11 @@ class Linemap
virtual std::string
to_string(Location) = 0;
- // Return the line number for a given location (for debugging dumps)
+ // Return the file name for a given location.
+ virtual std::string
+ location_file(Location) = 0;
+
+ // Return the line number for a given location.
virtual int
location_line(Location) = 0;
@@ -140,7 +144,15 @@ class Linemap
return Linemap::instance_->to_string(loc);
}
- // Return line number for location
+ // Return the file name of a location.
+ static std::string
+ location_to_file(Location loc)
+ {
+ go_assert(Linemap::instance_ != NULL);
+ return Linemap::instance_->location_file(loc);
+ }
+
+ // Return line number of a location.
static int
location_to_line(Location loc)
{