Initial conversion of dwarf_expr_ctx

This is the first step in the conversion of dwarf_expr_ctx to a C++
class.  This conversion is done in steps to make the patches, and the
reviews, a bit simpler.  This patch changes dwarf_expr_ctx to be
stack-allocated and removes the associated cleanup.

2016-10-21  Tom Tromey  <tom@tromey.com>

	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Stack-allocate
	dwarf_expr_context.  Remove cleanups.
	(dwarf2_locexpr_baton_eval)
	(dwarf2_loc_desc_get_symbol_read_needs):  Likewise.
	* dwarf2expr.h (dwarf_expr_context, ~dwarf_expr_context): Add
	constructors and destructors.
	(new_dwarf_expr_context, free_dwarf_expr_context)
	(make_cleanup_free_dwarf_expr_context): Don't declare.
	* dwarf2-frame.c (execute_stack_op): Stack-allocate
	dwarf_expr_context.  Remove cleanups.
	(dwarf_expr_context): Rename from new_dwarf_expr_context.  Turn
	into constructor.
	(free_dwarf_expr_context, free_dwarf_expr_context_cleanup):
	Remove.
	(~dwarf_expr_context): Rename from
	make_cleanup_free_dwarf_expr_context.  Turn into destructor.
This commit is contained in:
Tom Tromey
2016-09-25 16:28:03 -06:00
parent 5841433461
commit 718b962660
5 changed files with 110 additions and 117 deletions

View File

@@ -130,6 +130,9 @@ struct dwarf_stack_value
its current state and its callbacks. */
struct dwarf_expr_context
{
dwarf_expr_context ();
~dwarf_expr_context ();
/* The stack of values, allocated with xmalloc. */
struct dwarf_stack_value *stack;
@@ -250,11 +253,6 @@ struct dwarf_expr_piece
ULONGEST offset;
};
struct dwarf_expr_context *new_dwarf_expr_context (void);
void free_dwarf_expr_context (struct dwarf_expr_context *ctx);
struct cleanup *
make_cleanup_free_dwarf_expr_context (struct dwarf_expr_context *ctx);
void dwarf_expr_push_address (struct dwarf_expr_context *ctx,
CORE_ADDR value,
int in_stack_memory);