+2021-04-01 Simon Marchi <simon.marchi@efficios.com>
+
+ * gdbtypes.h (struct type) <is_declared_class,
+ set_is_declared_class>: New methods.
+ (TYPE_DECLARED_CLASS): Use type::is_declared_class, change all
+ write call sites to use type::set_is_declared_class.
+
2021-02-28 Boris Staletic <boris.staletic@gmail.com>
* gdb/python/lib/gdb/__init__.py: Use importlib on python 3.4+
}
if (cu->language == language_cplus && die->tag == DW_TAG_class_type)
- TYPE_DECLARED_CLASS (type) = 1;
+ type->set_is_declared_class (true);
/* Store the calling convention in the type if it's available in
the die. Otherwise the calling convention remains set to
set_type_align (type, TYPE_RAW_ALIGN (underlying_type));
}
- TYPE_DECLARED_CLASS (type) = dwarf2_flag_true_p (die, DW_AT_enum_class, cu);
+ type->set_is_declared_class (dwarf2_flag_true_p (die, DW_AT_enum_class, cu));
set_die_type (die, type, cu);
enum types, this is true when "enum class" or "enum struct" was
used to declare the type.. */
-#define TYPE_DECLARED_CLASS(t) (TYPE_MAIN_TYPE (t)->flag_declared_class)
+#define TYPE_DECLARED_CLASS(t) ((t)->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
/* * True if this type was declared with "class" rather than
"struct". */
- unsigned int flag_declared_class : 1;
+ unsigned int m_flag_declared_class : 1;
/* * True if this is an enum type with disjoint values. This
affects how the enum is printed. */
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
}
+
+ /* True if this type was declared using the "class" keyword. This is
+ only valid for C++ structure and enum types. If false, a structure
+ was declared as a "struct"; if true it was declared "class". For
+ enum types, this is true when "enum class" or "enum struct" was
+ used to declare the type. */
+
+ bool is_declared_class () const
+ {
+ return this->main_type->m_flag_declared_class;
+ }
+
+ void set_is_declared_class (bool is_declared_class) const
+ {
+ this->main_type->m_flag_declared_class = is_declared_class;
+ }
+
/* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
to this type's fixed_point_info. */