diff options
author | Tom Tromey <tromey@adacore.com> | 2021-09-13 12:31:20 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-10-05 12:34:55 -0600 |
commit | 3e44c3049fc23f5ba894b346b7defdfba66b076e (patch) | |
tree | 5486581f3787291c83ff78c0506f63dce9711136 /gdb/valops.c | |
parent | a519e8ffe2b0f008deaef1517562090d9eaadccc (diff) | |
download | gdb-3e44c3049fc23f5ba894b346b7defdfba66b076e.zip gdb-3e44c3049fc23f5ba894b346b7defdfba66b076e.tar.gz gdb-3e44c3049fc23f5ba894b346b7defdfba66b076e.tar.bz2 |
Allow lazy 'zero' value
This changes value_zero to create a lazy value. In many cases,
value_zero is called in expression evaluation to wrap a type in a
non-eval context. It seems senseless to allocate a buffer in these
cases.
A new 'is_zero' flag is added so we can preserve the existing
assertions in value_fetch_lazy.
A subsequent patch will add a test where creating a zero value would
fail, due to the variable size check. However, the contents of this
value are never needed, and so creating a lazy value avoids the error
case.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index a6c3632..f65479b 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -935,17 +935,6 @@ value_dynamic_cast (struct type *type, struct value *arg) 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 * |