gdb: add type::is_flag_enum / type::set_is_flag_enum
Add the `is_flag_enum` and `set_is_flag_enum` methods on `struct type`, in order to remove the `TYPE_FLAG_ENUM` 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_flag_enum, set_is_flag_enum>: New methods. (TYPE_FLAG_ENUM): Use type::is_flag_enum, change all write call sites to use type::set_is_flag_enum. Change-Id: I9c56c91626c8d784947ba94fcb97818526b81d1c
This commit is contained in:
parent
3bc440a2c4
commit
9902b32793
3 changed files with 24 additions and 7 deletions
|
@ -220,11 +220,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
|
|||
|
||||
#define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
|
||||
|
||||
/* * True if this type is a "flag" enum. A flag enum is one where all
|
||||
the values are pairwise disjoint when "and"ed together. This
|
||||
affects how enum values are printed. */
|
||||
|
||||
#define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum)
|
||||
#define TYPE_FLAG_ENUM(t) ((t)->is_flag_enum ())
|
||||
|
||||
/* * Constant type. If this is set, the corresponding type has a
|
||||
const modifier. */
|
||||
|
@ -812,7 +808,7 @@ struct main_type
|
|||
/* * True if this is an enum type with disjoint values. This
|
||||
affects how the enum is printed. */
|
||||
|
||||
unsigned int flag_flag_enum : 1;
|
||||
unsigned int m_flag_flag_enum : 1;
|
||||
|
||||
/* * A discriminant telling us which field of the type_specific
|
||||
union is being used for this type, if any. */
|
||||
|
@ -1196,6 +1192,20 @@ struct type
|
|||
this->main_type->m_flag_declared_class = is_declared_class;
|
||||
}
|
||||
|
||||
/* True if this type is a "flag" enum. A flag enum is one where all
|
||||
the values are pairwise disjoint when "and"ed together. This
|
||||
affects how enum values are printed. */
|
||||
|
||||
bool is_flag_enum () const
|
||||
{
|
||||
return this->main_type->m_flag_flag_enum;
|
||||
}
|
||||
|
||||
void set_is_flag_enum (bool is_flag_enum)
|
||||
{
|
||||
this->main_type->m_flag_flag_enum = is_flag_enum;
|
||||
}
|
||||
|
||||
/* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
|
||||
to this type's fixed_point_info. */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue