aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-07-08 23:20:01 -0400
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:49:35 +0100
commite659eca9f3b9c167c37a7862cb45d996fb784a6f (patch)
treeb4c4d8cbe4ba8b31bae126e7419a8ed8eb06bb80 /gcc
parentc12f4bc804aea07f0e9cb510c90b6cde1f0738ac (diff)
downloadgcc-e659eca9f3b9c167c37a7862cb45d996fb784a6f.zip
gcc-e659eca9f3b9c167c37a7862cb45d996fb784a6f.tar.gz
gcc-e659eca9f3b9c167c37a7862cb45d996fb784a6f.tar.bz2
gccrs: 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 628fecc..b5702a0 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 87b72f8..e7257e8 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 5b74464..81c622b 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.