aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-linemap.cc
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2016-10-10 17:33:32 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-10-10 17:33:32 +0000
commit71543388eec6aad6fb096b1de16264051cf06d3e (patch)
treef8073361e3fb096f990d2672a5480cd3528b458b /gcc/go/go-linemap.cc
parent5d8c099edebfe908256c2bd77a0e2b67182b0f57 (diff)
downloadgcc-71543388eec6aad6fb096b1de16264051cf06d3e.zip
gcc-71543388eec6aad6fb096b1de16264051cf06d3e.tar.gz
gcc-71543388eec6aad6fb096b1de16264051cf06d3e.tar.bz2
compiler: prune away gcc-specific linemap usage
Add an interface to the go Linemap class to allow clients to ask for the line number for a Location (for debugging dumps), so as to move some gcc-specific location code into the back end. Reviewed-on: https://go-review.googlesource.com/30699 * go-linemap.cc (Gcc_linemap::location_line): New method. From-SVN: r240942
Diffstat (limited to 'gcc/go/go-linemap.cc')
-rw-r--r--gcc/go/go-linemap.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/go/go-linemap.cc b/gcc/go/go-linemap.cc
index b58a54b..22498d9 100644
--- a/gcc/go/go-linemap.cc
+++ b/gcc/go/go-linemap.cc
@@ -32,6 +32,9 @@ class Gcc_linemap : public Linemap
std::string
to_string(Location);
+ int
+ location_line(Location);
+
protected:
Location
get_predeclared_location();
@@ -88,6 +91,13 @@ Gcc_linemap::to_string(Location location)
return ss.str();
}
+// Return the line number for a given location (for debugging dumps)
+int
+Gcc_linemap::location_line(Location loc)
+{
+ return LOCATION_LINE(loc.gcc_location());
+}
+
// Stop getting locations.
void