aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-10 15:47:21 -0600
committerTom Tromey <tom@tromey.com>2017-04-12 11:16:19 -0600
commit16e802b9c085ce354b1ab9e2fd25d00bf7626fa8 (patch)
tree7745d7708fd31fe748a6807242a3a6e58201f892 /gdb/linespec.h
parentd28cd78ad820e3a40ac5064b6a30f3a12ce70bf0 (diff)
downloadgdb-16e802b9c085ce354b1ab9e2fd25d00bf7626fa8.zip
gdb-16e802b9c085ce354b1ab9e2fd25d00bf7626fa8.tar.gz
gdb-16e802b9c085ce354b1ab9e2fd25d00bf7626fa8.tar.bz2
Add a constructor and destructor to linespec_result
linespec_result is only ever allocated on the stack, so it's relatively easy to convert to having a constructor and a destructor. This patch makes this change. This removes some cleanups. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * linespec.h (struct linespec_result): Add constructor and destructor. (init_linespec_result, destroy_linespec_result) (make_cleanup_destroy_linespec_result): Don't declare. * linespec.c (init_linespec_result): Remove. (linespec_result::~linespec_result): Rename from destroy_linespec_result. Update. (cleanup_linespec_result, make_cleanup_destroy_linespec_result): Remove. * breakpoint.c (create_breakpoint, break_range_command) (decode_location_default): Update. * ax-gdb.c (agent_command_1): Update.
Diffstat (limited to 'gdb/linespec.h')
-rw-r--r--gdb/linespec.h41
1 files changed, 19 insertions, 22 deletions
diff --git a/gdb/linespec.h b/gdb/linespec.h
index 4e69895..5ea8f6f 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -41,12 +41,12 @@ struct linespec_sals
{
/* This is the location corresponding to the sals contained in this
object. It can be passed as the FILTER argument to future calls
- to decode_line_full. This is freed by
- destroy_linespec_result. */
+ to decode_line_full. This is freed by the linespec_result
+ destructor. */
char *canonical;
- /* Sals. The 'sals' field is destroyed by
- destroy_linespec_result. */
+ /* Sals. The 'sals' field is destroyed by the linespec_result
+ destructor. */
struct symtabs_and_lines sals;
};
@@ -54,12 +54,23 @@ typedef struct linespec_sals linespec_sals;
DEF_VEC_O (linespec_sals);
/* An instance of this may be filled in by decode_line_1. The caller
- must call init_linespec_result to initialize it and
- destroy_linespec_result to destroy it. The caller must make copies
- of any data that it needs to keep. */
+ must make copies of any data that it needs to keep. */
struct linespec_result
{
+ linespec_result ()
+ : special_display (0),
+ pre_expanded (0),
+ location (NULL),
+ sals (NULL)
+ {
+ }
+
+ ~linespec_result ();
+
+ linespec_result (const linespec_result &) = delete;
+ linespec_result &operator= (const linespec_result &) = delete;
+
/* If non-zero, the linespec should be displayed to the user. This
is used by "unusual" linespecs where the ordinary `info break'
display mechanism would do the wrong thing. */
@@ -75,24 +86,10 @@ struct linespec_result
by the user. This will be freed by destroy_linespec_result. */
struct event_location *location;
- /* The sals. The vector will be freed by
- destroy_linespec_result. */
+ /* The sals. The vector will be freed by the destructor. */
VEC (linespec_sals) *sals;
};
-/* Initialize a linespec_result. */
-
-extern void init_linespec_result (struct linespec_result *);
-
-/* Destroy a linespec_result. */
-
-extern void destroy_linespec_result (struct linespec_result *);
-
-/* Return a cleanup that destroys a linespec_result. */
-
-extern struct cleanup *
- make_cleanup_destroy_linespec_result (struct linespec_result *);
-
/* Decode a linespec using the provided default symtab and line. */
extern struct symtabs_and_lines