aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-07-08 23:20:01 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-12 08:10:38 +0000
commitb68dd7e641dd9bf4afa32caa107dc67468d805d2 (patch)
tree4741367ecc23ad311896ef5d3708e158cb5cde81 /gcc
parentff2d1b7cea448c6f4a8918c45d58675ecc14623d (diff)
downloadgcc-b68dd7e641dd9bf4afa32caa107dc67468d805d2.zip
gcc-b68dd7e641dd9bf4afa32caa107dc67468d805d2.tar.gz
gcc-b68dd7e641dd9bf4afa32caa107dc67468d805d2.tar.bz2
Merge Linemap::to_string into Linemap::location_to_string
gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::dump_and_skip): Use location_to_string. * rust-linemap.cc (Linemap::to_string): Move to... (Linemap::location_to_string): ... here. * rust-linemap.h (Linemap::to_string): Remove. (Linemap::location_to_string): Remove definition. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/lex/rust-lex.cc2
-rw-r--r--gcc/rust/rust-linemap.cc2
-rw-r--r--gcc/rust/rust-linemap.h15
3 files changed, 6 insertions, 13 deletions
diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc
index bc739a6..8edefb4 100644
--- a/gcc/rust/lex/rust-lex.cc
+++ b/gcc/rust/lex/rust-lex.cc
@@ -246,7 +246,7 @@ Lexer::dump_and_skip (int n)
+ std::string (tok->get_type_hint_str ()))
: "")
<< " ";
- out << get_line_map ()->to_string (loc) << " ";
+ out << Linemap::location_to_string (loc) << " ";
}
token_queue.skip (0);
diff --git a/gcc/rust/rust-linemap.cc b/gcc/rust/rust-linemap.cc
index 51ef407..05c9f3d 100644
--- a/gcc/rust/rust-linemap.cc
+++ b/gcc/rust/rust-linemap.cc
@@ -36,7 +36,7 @@ Linemap::start_file (const char *file_name, unsigned line_begin)
// Stringify a location
std::string
-Linemap::to_string (Location location)
+Linemap::location_to_string (Location location)
{
const line_map_ordinary *lmo;
location_t resolved_location;
diff --git a/gcc/rust/rust-linemap.h b/gcc/rust/rust-linemap.h
index 58f56f8..1aca05a 100644
--- a/gcc/rust/rust-linemap.h
+++ b/gcc/rust/rust-linemap.h
@@ -60,11 +60,6 @@ public:
// input files have been read, in case any cleanup is required.
void stop ();
- // Produce a human-readable description of a Location, e.g.
- // "foo.rust:10". Returns an empty string for predeclared, builtin or
- // unknown locations.
- std::string to_string (Location);
-
protected:
// The single existing instance of Linemap.
static Linemap *instance_;
@@ -77,12 +72,10 @@ public:
// Return the special Location used for predeclared identifiers.
static Location predeclared_location () { return BUILTINS_LOCATION; }
- // Produce a human-readable description of a Location.
- static std::string location_to_string (Location loc)
- {
- rust_assert (Linemap::instance_ != NULL);
- return Linemap::instance_->to_string (loc);
- }
+ // Produce a human-readable description of a Location, e.g.
+ // "foo.rust:10". Returns an empty string for predeclared, builtin or
+ // unknown locations.
+ static std::string location_to_string (Location loc);
private:
// Whether we are currently reading a file.