diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-07-12 22:58:51 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-07-12 22:58:51 -0400 |
commit | 8c2e4e0689ea244d0ed979171a3d09c9176b8175 (patch) | |
tree | 8e1f4e0993f7f25a0946d64088015a88f883c8fd /gdb/gnu-v3-abi.c | |
parent | 7c6f271296319576fa00587928e5ff52ced9c1bb (diff) | |
download | gdb-8c2e4e0689ea244d0ed979171a3d09c9176b8175.zip gdb-8c2e4e0689ea244d0ed979171a3d09c9176b8175.tar.gz gdb-8c2e4e0689ea244d0ed979171a3d09c9176b8175.tar.bz2 |
gdb: add accessors to struct dynamic_prop
Add setters, to ensure that the kind and value of the property are
always kept in sync (a caller can't forget one or the other). Add
getters, such that we can assert that when a caller accesses a data bit
of the property, the property is indeed of the corresponding kind.
Note that because of the way `struct dynamic_prop` is allocated
currently, we can't make the `m_kind` and `m_data` fields private. That
would make the type non-default-constructible, and we would have to call
the constructor when allocating them. However, I still prefixed them
with `m_` to indicate that they should not be accessed from outside the
class (and also to be able to use the name `kind` for the method).
gdb/ChangeLog:
* gdbtypes.h (struct dynamic_prop) <kind, set_undefined,
const_val, set_const_val, baton, set_locexpr, set_loclist,
set_addr_offset, variant_parts, set_variant_parts,
original_type, set_original_type>: New methods.
<kind>: Rename to...
<m_kind>: ... this. Update all users to use the new methods
instead.
<data>: Rename to...
<m_data>: ... this. Update all users to use the new methods
instead.
Change-Id: Ib72a8eb440dfeb1a5421d0933334230d7f2478f9
Diffstat (limited to 'gdb/gnu-v3-abi.c')
-rw-r--r-- | gdb/gnu-v3-abi.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 23c9c94..beff8b1 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -471,8 +471,7 @@ gnuv3_baseclass_offset (struct type *type, int index, baton.locexpr = *TYPE_FIELD_DWARF_BLOCK (type, index); struct dynamic_prop prop; - prop.kind = PROP_LOCEXPR; - prop.data.baton = &baton; + prop.set_locexpr (&baton); struct property_addr_info addr_stack; addr_stack.type = type; |