From cbe793af8831a7244de326d6b07c60c197f096a2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 31 Jan 2023 13:24:00 -0700 Subject: Turn allocate_value_lazy into a static "constructor" This changes allocate_value_lazy to be a static "constructor" of struct value. I considered trying to change value to use ordinary new/delete, but it seems to me that due to reference counting, we may someday want to change these static constructors to return value_ref_ptr instead. Approved-By: Simon Marchi --- gdb/value.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gdb/value.h') diff --git a/gdb/value.h b/gdb/value.h index 788a3d8514e..29ed2a8a3ce 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -144,6 +144,9 @@ typedef gdb::ref_ptr value_ref_ptr; struct value { +private: + + /* Values can only be created via "static constructors". */ explicit value (struct type *type_) : m_modifiable (1), m_lazy (1), @@ -156,6 +159,13 @@ struct value { } +public: + + /* Allocate a lazy value for type TYPE. Its actual content is + "lazily" allocated too: the content field of the return value is + NULL; it will be allocated when it is fetched from the target. */ + static struct value *allocate_lazy (struct type *type); + ~value (); DISABLE_COPY_AND_ASSIGN (value); @@ -1002,7 +1012,7 @@ extern struct value *read_var_value (struct symbol *var, frame_info_ptr frame); extern struct value *allocate_value (struct type *type); -extern struct value *allocate_value_lazy (struct type *type); + extern void value_contents_copy (struct value *dst, LONGEST dst_offset, struct value *src, LONGEST src_offset, LONGEST length); -- cgit v1.2.1