error (_("dynamic_cast failed"));
}
-/* Create a value of type TYPE that is zero, and return it. */
-
-struct value *
-value_zero (struct type *type, enum lval_type lv)
-{
- struct value *val = allocate_value (type);
-
- VALUE_LVAL (val) = (lv == lval_computed ? not_lval : lv);
- return val;
-}
-
/* Create a not_lval value of numeric type TYPE that is one, and return it. */
struct value *
lazy (1),
initialized (1),
stack (0),
+ is_zero (false),
type (type_),
enclosing_type (type_)
{
used instead of read_memory to enable extra caching. */
unsigned int stack : 1;
+ /* True if this is a zero value, created by 'value_zero'; false
+ otherwise. */
+ bool is_zero : 1;
+
/* Location of value (if lval). */
union
{
val->pointed_to_offset = arg->pointed_to_offset;
val->modifiable = arg->modifiable;
val->stack = arg->stack;
+ val->is_zero = arg->is_zero;
val->initialized = arg->initialized;
if (!value_lazy (val))
{
}
+/* Create a value of type TYPE that is zero, and return it. */
+
+struct value *
+value_zero (struct type *type, enum lval_type lv)
+{
+ struct value *val = allocate_value_lazy (type);
+
+ VALUE_LVAL (val) = (lv == lval_computed ? not_lval : lv);
+ val->is_zero = true;
+ return val;
+}
+
/* Convert C numbers into newly allocated values. */
struct value *
value. */
gdb_assert (val->optimized_out.empty ());
gdb_assert (val->unavailable.empty ());
- if (value_bitsize (val))
+ if (val->is_zero)
+ {
+ /* Nothing. */
+ }
+ else if (value_bitsize (val))
value_fetch_lazy_bitfield (val);
else if (VALUE_LVAL (val) == lval_memory)
value_fetch_lazy_memory (val);