+2020-09-14  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdbtypes.h (struct type) <endianity_is_not_default,
+       set_endianity_is_not_default>: New methods.
+       (TYPE_ENDIANITY_NOT_DEFAULT): Use
+       type::endianity_is_not_default, change all write call sites to
+       use type::set_endianity_is_not_default.
+
 2020-09-14  Simon Marchi  <simon.marchi@efficios.com>
 
        * gdbtypes.h (TYPE_FIXED_INSTANCE): Remove, replace all
 
 
   maybe_set_alignment (cu, die, type);
 
-  TYPE_ENDIANITY_NOT_DEFAULT (type) = gdbarch_byte_order (arch) != byte_order;
+  type->set_endianity_is_not_default (gdbarch_byte_order (arch) != byte_order);
 
   return set_die_type (die, type, cu);
 }
 
   if (high_bound->kind () == PROP_CONST && high_bound->const_val () < 0)
     result_type->set_is_unsigned (false);
 
-  TYPE_ENDIANITY_NOT_DEFAULT (result_type)
-    = TYPE_ENDIANITY_NOT_DEFAULT (index_type);
+  result_type->set_endianity_is_not_default
+    (index_type->endianity_is_not_default ());
 
   return result_type;
 }
 
    that indicates the desired endian interpretation of the variable
    differs from the native endian representation. */
 
-#define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default)
+#define TYPE_ENDIANITY_NOT_DEFAULT(t) ((t)->endianity_is_not_default ())
 
 /* * Not textual.  By default, GDB treats all single byte integers as
    characters (or elements of strings) unless this flag is set.  */
   unsigned int m_flag_gnu_ifunc : 1;
   unsigned int m_flag_fixed_instance : 1;
   unsigned int flag_objfile_owned : 1;
-  unsigned int flag_endianity_not_default : 1;
+  unsigned int m_flag_endianity_not_default : 1;
 
   /* * True if this type was declared with "class" rather than
      "struct".  */
     this->main_type->m_flag_fixed_instance = is_fixed_instance;
   }
 
+  bool endianity_is_not_default () const
+  {
+    return this->main_type->m_flag_endianity_not_default;
+  }
+
+  void set_endianity_is_not_default (bool endianity_is_not_default)
+  {
+    this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
+  }
+
   /* * 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;