aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-07-03 12:44:54 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-07 10:37:44 +0000
commita5abd7d778bdfc2b2d7899d09e428d2d02d88027 (patch)
treebc5b090775430c884ec792b81defae92abd7ace7
parentb9566fddf2915f68f050844df699389474c49ac4 (diff)
downloadgcc-a5abd7d778bdfc2b2d7899d09e428d2d02d88027.zip
gcc-a5abd7d778bdfc2b2d7899d09e428d2d02d88027.tar.gz
gcc-a5abd7d778bdfc2b2d7899d09e428d2d02d88027.tar.bz2
Reduce Linemap/Gcc_linemap abstraction
This should help work towards the removal of Linemap/Gcc_linemap. gcc/rust/ChangeLog: * rust-linemap.cc (Gcc_linemap::get_unknown_location): Remove. (Gcc_linemap::get_predeclared_location): Remove. (Gcc_linemap::is_predeclared): Remove. (Gcc_linemap::is_unknown): Remove. * rust-linemap.h (Linemap::get_predeclared_location): Remove. (Linemap::get_unknown_location): Remove. (Linemap::is_predeclared): Remove. (Linemap::is_unknown): Remove. (Linemap::predeclared_location): Use BUILTINS_LOCATION. (Linemap::unknown_location): Use UNKNOWN_LOCATION. (Linemap::is_predeclared_location): Remove. (Linemap::is_unknown_location): Remove. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r--gcc/rust/rust-linemap.cc41
-rw-r--r--gcc/rust/rust-linemap.h46
2 files changed, 2 insertions, 85 deletions
diff --git a/gcc/rust/rust-linemap.cc b/gcc/rust/rust-linemap.cc
index aba3ae7..1dc50dc 100644
--- a/gcc/rust/rust-linemap.cc
+++ b/gcc/rust/rust-linemap.cc
@@ -44,15 +44,6 @@ public:
int location_column (Location);
-protected:
- Location get_predeclared_location ();
-
- Location get_unknown_location ();
-
- bool is_predeclared (Location);
-
- bool is_unknown (Location);
-
private:
// Whether we are currently reading a file.
bool in_file_;
@@ -144,38 +135,6 @@ Gcc_linemap::get_location (unsigned column)
return Location (linemap_position_for_column (line_table, column));
}
-// Get the unknown location.
-
-Location
-Gcc_linemap::get_unknown_location ()
-{
- return Location (UNKNOWN_LOCATION);
-}
-
-// Get the predeclared location.
-
-Location
-Gcc_linemap::get_predeclared_location ()
-{
- return Location (BUILTINS_LOCATION);
-}
-
-// Return whether a location is the predeclared location.
-
-bool
-Gcc_linemap::is_predeclared (Location loc)
-{
- return loc == BUILTINS_LOCATION;
-}
-
-// Return whether a location is the unknown location.
-
-bool
-Gcc_linemap::is_unknown (Location loc)
-{
- return loc == UNKNOWN_LOCATION;
-}
-
// Return the Linemap to use for the gcc backend.
Linemap *
diff --git a/gcc/rust/rust-linemap.h b/gcc/rust/rust-linemap.h
index 94fa0e9e..ae8f6f6 100644
--- a/gcc/rust/rust-linemap.h
+++ b/gcc/rust/rust-linemap.h
@@ -76,24 +76,6 @@ public:
virtual int location_column (Location) = 0;
protected:
- // Return a special Location used for predeclared identifiers. This
- // Location should be different from that for any actual source
- // file. This location will be used for various different types,
- // functions, and objects created by the frontend.
- virtual Location get_predeclared_location () = 0;
-
- // Return a special Location which indicates that no actual location
- // is known. This is used for undefined objects and for errors.
- virtual Location get_unknown_location () = 0;
-
- // Return whether the argument is the Location returned by
- // get_predeclared_location.
- virtual bool is_predeclared (Location) = 0;
-
- // Return whether the argument is the Location returned by
- // get_unknown_location.
- virtual bool is_unknown (Location) = 0;
-
// The single existing instance of Linemap.
static Linemap *instance_;
@@ -103,34 +85,10 @@ public:
// an instance of Linemap.
// Return the special Location used for predeclared identifiers.
- static Location predeclared_location ()
- {
- rust_assert (Linemap::instance_ != NULL);
- return Linemap::instance_->get_predeclared_location ();
- }
+ static Location predeclared_location () { return BUILTINS_LOCATION; }
// Return the special Location used when no location is known.
- static Location unknown_location ()
- {
- rust_assert (Linemap::instance_ != NULL);
- return Linemap::instance_->get_unknown_location ();
- }
-
- // Return whether the argument is the special location used for
- // predeclared identifiers.
- static bool is_predeclared_location (Location loc)
- {
- rust_assert (Linemap::instance_ != NULL);
- return Linemap::instance_->is_predeclared (loc);
- }
-
- // Return whether the argument is the special location used when no
- // location is known.
- static bool is_unknown_location (Location loc)
- {
- rust_assert (Linemap::instance_ != NULL);
- return Linemap::instance_->is_unknown (loc);
- }
+ static Location unknown_location () { return UNKNOWN_LOCATION; }
// Produce a human-readable description of a Location.
static std::string location_to_string (Location loc)