public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Turn value_initialized and set_value_initialized functions into methods
@ 2023-02-13 22:28 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-02-13 22:28 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8e5b19ad992b56cb3817dcbd4c656e2ffc3ee889

commit 8e5b19ad992b56cb3817dcbd4c656e2ffc3ee889
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Jan 31 12:22:01 2023 -0700

    Turn value_initialized and set_value_initialized functions into methods
    
    This changes the value_initialized and set_value_initialized functions
    to be methods of value.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/c-valprint.c  |  2 +-
 gdb/dwarf2/expr.c |  2 +-
 gdb/value.c       | 16 ----------------
 gdb/value.h       | 15 +++++++++------
 4 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 0a9e4f49ba6..8cfb3786043 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -554,7 +554,7 @@ c_value_print (struct value *val, struct ui_file *stream,
 	}
     }
 
-  if (!value_initialized (val))
+  if (!val->initialized ())
     gdb_printf (stream, " [uninitialized] ");
 
   if (options->objectprint && (type->code () == TYPE_CODE_STRUCT))
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 8d845e892e3..d6ad0f1776b 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -1057,7 +1057,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
 	}
     }
 
-  set_value_initialized (retval, this->m_initialized);
+  retval->set_initialized (this->m_initialized);
 
   return retval;
 }
diff --git a/gdb/value.c b/gdb/value.c
index c56c04d448f..399e2d1e0b2 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3799,22 +3799,6 @@ using_struct_return (struct gdbarch *gdbarch,
 	  != RETURN_VALUE_REGISTER_CONVENTION);
 }
 
-/* Set the initialized field in a value struct.  */
-
-void
-set_value_initialized (struct value *val, int status)
-{
-  val->m_initialized = status;
-}
-
-/* Return the initialized field in a value struct.  */
-
-int
-value_initialized (const struct value *val)
-{
-  return val->m_initialized;
-}
-
 /* Helper for value_fetch_lazy when the value is a bitfield.  */
 
 static void
diff --git a/gdb/value.h b/gdb/value.h
index 30c2cb48b70..e813970f9f5 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -316,6 +316,15 @@ struct value
   enum lval_type lval () const
   { return m_lval; }
 
+  /* Set or return field indicating whether a variable is initialized or
+     not, based on debugging information supplied by the compiler.
+     1 = initialized; 0 = uninitialized.  */
+  int initialized () const
+  { return m_initialized; }
+
+  void set_initialized (int value)
+  { m_initialized = value; }
+
 
   /* Type of value; either not an lval, or one of the various
      different possible kinds of lval.  */
@@ -657,12 +666,6 @@ extern void mark_value_bytes_optimized_out (struct value *value,
 extern void mark_value_bits_optimized_out (struct value *value,
 					   LONGEST offset, LONGEST length);
 
-/* Set or return field indicating whether a variable is initialized or
-   not, based on debugging information supplied by the compiler.
-   1 = initialized; 0 = uninitialized.  */
-extern int value_initialized (const struct value *);
-extern void set_value_initialized (struct value *, int);
-
 /* Set COMPONENT's location as appropriate for a component of WHOLE
    --- regardless of what kind of lvalue WHOLE is.  */
 extern void set_value_component_location (struct value *component,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-13 22:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 22:28 [binutils-gdb] Turn value_initialized and set_value_initialized functions into methods Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).