[3/6] Change value::m_initialized to bool
Commit Message
This changes value::m_initialized to be a bool and updates the various
uses.
---
gdb/dwarf2/expr.c | 4 ++--
gdb/dwarf2/expr.h | 6 +++---
gdb/value.h | 10 +++++-----
3 files changed, 10 insertions(+), 10 deletions(-)
Comments
On Tue, Feb 14, 2023 at 9:24 PM Tom Tromey <tom@tromey.com> wrote:
> This changes value::m_initialized to be a bool and updates the various
> uses.
>
> I think it looks good and is good to go.
@@ -1496,7 +1496,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
type *address_type = this->address_type ();
this->m_location = DWARF_VALUE_MEMORY;
- this->m_initialized = 1; /* Default is initialized. */
+ this->m_initialized = true; /* Default is initialized. */
if (this->m_recursion_depth > this->m_max_recursion_depth)
error (_("DWARF-2 expression error: Loop detected (%d)."),
@@ -2192,7 +2192,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
"be the very last op."));
- this->m_initialized = 0;
+ this->m_initialized = false;
goto no_push;
case DW_OP_call2:
@@ -164,9 +164,9 @@ struct dwarf_expr_context
ULONGEST m_len = 0;
const gdb_byte *m_data = nullptr;
- /* Initialization status of variable: Non-zero if variable has been
- initialized; zero otherwise. */
- int m_initialized = 0;
+ /* Initialization status of variable: True if variable has been
+ initialized; false otherwise. */
+ bool m_initialized = false;
/* A vector of pieces.
@@ -134,7 +134,7 @@ struct value
explicit value (struct type *type_)
: m_modifiable (true),
m_lazy (true),
- m_initialized (1),
+ m_initialized (true),
m_stack (0),
m_is_zero (false),
m_in_history (false),
@@ -338,11 +338,11 @@ struct value
/* 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
+ true = initialized; false = uninitialized. */
+ bool initialized () const
{ return m_initialized; }
- void set_initialized (int value)
+ void set_initialized (bool value)
{ m_initialized = value; }
/* If lval == lval_memory, return the address in the inferior. If
@@ -638,7 +638,7 @@ struct value
bool m_lazy : 1;
/* If value is a variable, is it initialized or not. */
- unsigned int m_initialized : 1;
+ bool m_initialized : 1;
/* If value is from the stack. If this is set, read_stack will be
used instead of read_memory to enable extra caching. */