diff options
author | Pedro Alves <pedro@palves.net> | 2022-05-27 16:33:56 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2022-06-17 09:58:49 +0100 |
commit | 7464aeaab47ca3fb7127223fe372489c9c7ed69e (patch) | |
tree | 0b301cd6c229f435b44b97b81ac543ab840a0a2b /gdb/location.h | |
parent | 238dc9af03392ecd8129ee54a340efd736782cf9 (diff) | |
download | gdb-7464aeaab47ca3fb7127223fe372489c9c7ed69e.zip gdb-7464aeaab47ca3fb7127223fe372489c9c7ed69e.tar.gz gdb-7464aeaab47ca3fb7127223fe372489c9c7ed69e.tar.bz2 |
Convert location_spec_type to a method
This converts location_spec_type to location_spec::type().
Change-Id: Iff4cbfafb1cf3d22adfa142ff939b4a148e52273
Diffstat (limited to 'gdb/location.h')
-rw-r--r-- | gdb/location.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gdb/location.h b/gdb/location.h index f3b6332..9ba3a20 100644 --- a/gdb/location.h +++ b/gdb/location.h @@ -93,8 +93,11 @@ struct location_spec return as_string.c_str (); } - /* The type of this location specification. */ - enum location_spec_type type; + /* Return this location spec's type. */ + enum location_spec_type type () const + { + return m_type; + } /* Cached string representation of this location spec. This is used, e.g., to save location specs to file. */ @@ -103,25 +106,29 @@ struct location_spec protected: explicit location_spec (enum location_spec_type t) - : type (t) + : m_type (t) { } location_spec (enum location_spec_type t, std::string &&str) - : type (t), - as_string (std::move (str)) + : as_string (std::move (str)), + m_type (t) { } location_spec (const location_spec &other) - : type (other.type), - as_string (other.as_string) + : as_string (other.as_string), + m_type (other.m_type) { } /* Compute the string representation of this object. This is called by to_string when needed. */ virtual std::string compute_string () const = 0; + +private: + /* The type of this location specification. */ + enum location_spec_type m_type; }; /* A "normal" linespec. */ @@ -226,11 +233,6 @@ protected: std::string compute_string () const override; }; -/* Return the type of the given location spec. */ - -extern enum location_spec_type - location_spec_type (const location_spec *); - /* Return a string representation of LOCSPEC. This function may return NULL for unspecified linespecs, e.g, LINESPEC_LOCATION_SPEC and spec_string is NULL. |