compiler: add location_file
Add support for getting the file name from a Location value. This
will be used by later work.
Requires a change to the backend interface:
Index: go-linemap.cc
===================================================================
--- go-linemap.cc (revision 264872)
+++ go-linemap.cc (working copy)
@@ -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)
{
Change-Id: Ibc416297c7e303fbbb1dcc8e0a6b3aaef2e5b364
Reviewed-on: https://go-review.googlesource.com/c/145318
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
1 file changed