aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-09-14 11:08:06 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-09-14 11:08:06 -0400
commit9cdd0d12cc05495da96559ce80ad5b0467d33417 (patch)
tree97b897147678aea3e2245118845d31962548d3ac
parent0becda7a5a1845c7e91ccba1b27da3607de3f534 (diff)
downloadfsf-binutils-gdb-9cdd0d12cc05495da96559ce80ad5b0467d33417.zip
fsf-binutils-gdb-9cdd0d12cc05495da96559ce80ad5b0467d33417.tar.gz
fsf-binutils-gdb-9cdd0d12cc05495da96559ce80ad5b0467d33417.tar.bz2
gdb: add type::is_fixed_instance / type::set_is_fixed_instance
Add the `is_fixed_instance` and `set_is_fixed_instance` methods on `struct type`, in order to remove the `TYPE_FIXED_INSTANCE` macro. In this patch, the macro is changed to use the getter, so all the call sites of the macro that are used as a setter are changed to use the setter method directly. The next patch will remove the macro completely. gdb/ChangeLog: * gdbtypes.h (struct type) <is_fixed_instance, set_is_fixed_instance>: New methods. (TYPE_FIXED_INSTANCE): Use type::is_fixed_instance, change all write call sites to use type::set_is_fixed_instance. Change-Id: I4401d81512fab9eab4232bbea48ce6c7d586b94c
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/ada-lang.c12
-rw-r--r--gdb/gdbtypes.h14
3 files changed, 25 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eba28b8..29212d9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+ * gdbtypes.h (struct type) <is_fixed_instance,
+ set_is_fixed_instance>: New methods.
+ (TYPE_FIXED_INSTANCE): Use type::is_fixed_instance, change all
+ write call sites to use type::set_is_fixed_instance.
+
+2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+
* gdbtypes.h (TYPE_GNU_IFUNC): Remove, replace all
uses with type::is_gnu_ifunc.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4aaf862..1f9c274 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2108,7 +2108,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
(*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
- TYPE_FIXED_INSTANCE (new_type) = 1;
+ new_type->set_is_fixed_instance (true);
return new_type;
}
@@ -7820,7 +7820,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
rtype->set_fields
((struct field *) TYPE_ZALLOC (rtype, nfields * sizeof (struct field)));
rtype->set_name (ada_type_name (type));
- TYPE_FIXED_INSTANCE (rtype) = 1;
+ rtype->set_is_fixed_instance (true);
off = 0;
bit_len = 0;
@@ -8100,7 +8100,7 @@ template_to_static_fixed_type (struct type *type0)
type->set_fields (fields);
type->set_name (ada_type_name (type0));
- TYPE_FIXED_INSTANCE (type) = 1;
+ type->set_is_fixed_instance (true);
TYPE_LENGTH (type) = 0;
}
type->field (f).set_type (new_type);
@@ -8151,7 +8151,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
rtype->set_fields (fields);
rtype->set_name (ada_type_name (type));
- TYPE_FIXED_INSTANCE (rtype) = 1;
+ rtype->set_is_fixed_instance (true);
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type
@@ -8223,7 +8223,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
}
else
{
- TYPE_FIXED_INSTANCE (type0) = 1;
+ type0->set_is_fixed_instance (true);
return type0;
}
@@ -8489,7 +8489,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
TYPE_LENGTH (result)++;
}
- TYPE_FIXED_INSTANCE (result) = 1;
+ result->set_is_fixed_instance (true);
return result;
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f72f711..4bd7c34 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -226,7 +226,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
further interpretation. Optionally marks ordinary, fixed-size GDB
type. */
-#define TYPE_FIXED_INSTANCE(t) (TYPE_MAIN_TYPE (t)->flag_fixed_instance)
+#define TYPE_FIXED_INSTANCE(t) ((t)->is_fixed_instance ())
/* * Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
@@ -808,7 +808,7 @@ struct main_type
unsigned int m_flag_vector : 1;
unsigned int m_flag_stub_supported : 1;
unsigned int m_flag_gnu_ifunc : 1;
- unsigned int flag_fixed_instance : 1;
+ unsigned int m_flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
unsigned int flag_endianity_not_default : 1;
@@ -1141,6 +1141,16 @@ struct type
this->main_type->m_flag_gnu_ifunc = is_gnu_ifunc;
}
+ bool is_fixed_instance () const
+ {
+ return this->main_type->m_flag_fixed_instance;
+ }
+
+ void set_is_fixed_instance (bool is_fixed_instance)
+ {
+ this->main_type->m_flag_fixed_instance = is_fixed_instance;
+ }
+
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;