+2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+
+ * gdbtypes.h (struct type) <target_is_stub, set_target_is_stub>:
+ New methods.
+ (TYPE_TARGET_STUB): Use type::is_stub, change all write call
+ sites to use type::set_target_is_stub.
+
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_STUB): Remove, replace all
{
range_type->bounds ()->high.set_undefined ();
TYPE_LENGTH (type) = 0;
- TYPE_TARGET_STUB (type) = 1;
+ type->set_target_is_stub (true);
}
else
TYPE_LENGTH (type) = ctf_type_size (fp, tid);
TYPE_TARGET_TYPE (this_type) = target_type;
else
TYPE_TARGET_TYPE (this_type) = NULL;
- TYPE_TARGET_STUB (this_type) = TYPE_TARGET_TYPE (this_type) ? 1 : 0;
+
+ this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr);
return set_tid_type (objfile, tid, this_type);
}
name = dwarf2_full_name (NULL, die, cu);
this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name);
- TYPE_TARGET_STUB (this_type) = 1;
+ this_type->set_target_is_stub (true);
set_die_type (die, this_type, cu);
target_type = die_type (die, cu);
if (target_type != this_type)
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t");
TYPE_TARGET_TYPE (pid_type) = int32_type;
- TYPE_TARGET_STUB (pid_type) = 1;
+ pid_type->set_target_is_stub (true);
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT,
"__uid_t");
TYPE_TARGET_TYPE (uid_type) = uint32_type;
- TYPE_TARGET_STUB (uid_type) = 1;
+ pid_type->set_target_is_stub (true);
/* _reason */
reason_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
result_type->set_code (TYPE_CODE_RANGE);
TYPE_TARGET_TYPE (result_type) = index_type;
if (index_type->is_stub ())
- TYPE_TARGET_STUB (result_type) = 1;
+ result_type->set_target_is_stub (true);
else
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
/* TYPE_TARGET_STUB will take care of zero length arrays. */
if (TYPE_LENGTH (result_type) == 0)
- TYPE_TARGET_STUB (result_type) = 1;
+ result_type->set_target_is_stub (true);
return result_type;
}
else if (type->code () == TYPE_CODE_RANGE)
{
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
- TYPE_TARGET_STUB (type) = 0;
+ type->set_target_is_stub (false);
}
else if (type->code () == TYPE_CODE_ARRAY
&& update_static_array_size (type))
- TYPE_TARGET_STUB (type) = 0;
+ type->set_target_is_stub (false);
}
type = make_qualified_type (type, instance_flags, NULL);
based on the TYPE_LENGTH of the target type. Also, set for
TYPE_CODE_TYPEDEF. */
-#define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub)
+#define TYPE_TARGET_STUB(t) ((t)->target_is_stub ())
/* * This is a function type which appears to have a prototype. We
need this for function calls in order to tell us if it's necessary
unsigned int m_flag_unsigned : 1;
unsigned int m_flag_nosign : 1;
unsigned int m_flag_stub : 1;
- unsigned int flag_target_stub : 1;
+ unsigned int m_flag_target_stub : 1;
unsigned int flag_prototyped : 1;
unsigned int flag_varargs : 1;
unsigned int flag_vector : 1;
this->main_type->m_flag_stub = is_stub;
}
+ bool target_is_stub () const
+ {
+ return this->main_type->m_flag_target_stub;
+ }
+
+ void set_target_is_stub (bool target_is_stub)
+ {
+ this->main_type->m_flag_target_stub = target_is_stub;
+ }
+
/* * 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;
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (int_type) * TARGET_CHAR_BIT, "__pid_t");
TYPE_TARGET_TYPE (pid_type) = int_type;
- TYPE_TARGET_STUB (pid_type) = 1;
+ pid_type->set_target_is_stub (true);
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (uint_type) * TARGET_CHAR_BIT, "__uid_t");
TYPE_TARGET_TYPE (uid_type) = uint_type;
- TYPE_TARGET_STUB (uid_type) = 1;
+ uid_type->set_target_is_stub (true);
/* __clock_t */
clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
TYPE_LENGTH (long_type) * TARGET_CHAR_BIT,
"__clock_t");
TYPE_TARGET_TYPE (clock_type) = long_type;
- TYPE_TARGET_STUB (clock_type) = 1;
+ clock_type->set_target_is_stub (true);
/* _sifields */
sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
/* TYPE_TARGET_STUB now takes care of the zero TYPE_LENGTH problem. */
if (TYPE_LENGTH (*tpp) == 0)
- TYPE_TARGET_STUB (t) = 1;
+ t->set_target_is_stub (true);
*tpp = t;
return 4 + off;
}
else
{
- TYPE_TARGET_STUB (type) = 1;
+ type->set_target_is_stub (true);
TYPE_TARGET_TYPE (type) = xtype;
}
}