This converts location_spec_type to location_spec::type().
Change-Id: Iff4cbfafb1cf3d22adfa142ff939b4a148e52273
{
struct symtab_and_line cursal;
- if (location_spec_type (locspec) == LINESPEC_LOCATION_SPEC)
+ if (locspec->type () == LINESPEC_LOCATION_SPEC)
{
const char *spec = as_linespec_location_spec (locspec)->spec_string;
{
const char *spec = NULL;
- if (location_spec_type (locspec) == LINESPEC_LOCATION_SPEC)
+ if (locspec->type () == LINESPEC_LOCATION_SPEC)
spec = as_linespec_location_spec (locspec)->spec_string;
if (!cursal.symtab
{
if (locspec != nullptr)
return (breakpoint_ops_for_location_spec_type
- (location_spec_type (locspec), is_tracepoint));
+ (locspec->type (), is_tracepoint));
return &code_breakpoint_ops;
}
code_breakpoint::decode_location_spec (location_spec *locspec,
program_space *search_pspace)
{
- if (location_spec_type (locspec) == PROBE_LOCATION_SPEC)
+ if (locspec->type () == PROBE_LOCATION_SPEC)
return bkpt_probe_decode_location_spec (this, locspec, search_pspace);
return decode_location_spec_default (this, locspec, search_pspace);
{
std::vector<symtab_and_line> result;
- switch (location_spec_type (locspec))
+ switch (locspec->type ())
{
case LINESPEC_LOCATION_SPEC:
{
/* See description in location.h. */
-enum location_spec_type
-location_spec_type (const location_spec *locspec)
-{
- return locspec->type;
-}
-
-/* See description in location.h. */
-
location_spec_up
new_linespec_location_spec (const char **linespec,
symbol_name_match_type match_type)
const linespec_location_spec *
as_linespec_location_spec (const location_spec *locspec)
{
- gdb_assert (locspec->type == LINESPEC_LOCATION_SPEC);
+ gdb_assert (locspec->type () == LINESPEC_LOCATION_SPEC);
return static_cast<const linespec_location_spec *> (locspec);
}
const address_location_spec *
as_address_location_spec (const location_spec *locspec)
{
- gdb_assert (locspec->type == ADDRESS_LOCATION_SPEC);
+ gdb_assert (locspec->type () == ADDRESS_LOCATION_SPEC);
return static_cast<const address_location_spec *> (locspec);
}
const probe_location_spec *
as_probe_location_spec (const location_spec *locspec)
{
- gdb_assert (locspec->type == PROBE_LOCATION_SPEC);
+ gdb_assert (locspec->type () == PROBE_LOCATION_SPEC);
return static_cast<const probe_location_spec *> (locspec);
}
const explicit_location_spec *
as_explicit_location_spec (const location_spec *locspec)
{
- gdb_assert (locspec->type == EXPLICIT_LOCATION_SPEC);
+ gdb_assert (locspec->type () == EXPLICIT_LOCATION_SPEC);
return static_cast<const explicit_location_spec *> (locspec);
}
explicit_location_spec *
as_explicit_location_spec (location_spec *locspec)
{
- gdb_assert (locspec->type == EXPLICIT_LOCATION_SPEC);
+ gdb_assert (locspec->type () == EXPLICIT_LOCATION_SPEC);
return static_cast<explicit_location_spec *> (locspec);
}
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. */
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. */
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.
char *objfile_namestr = NULL, *provider = NULL, *name, *p;
const char *arg_start, *cs;
- gdb_assert (location_spec_type (locspec) == PROBE_LOCATION_SPEC);
+ gdb_assert (locspec->type () == PROBE_LOCATION_SPEC);
arg_start = locspec->to_string ();
cs = arg_start;