+ QUIT;
+ for (int i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); ++i)
+ if (TYPE_TYPEDEF_FIELD_PROTECTED (type, i)
+ || TYPE_TYPEDEF_FIELD_PRIVATE (type, i))
+ return true;
+ }
+
+ return false;
+}
+
+/* Helper function that temporarily disables FLAGS->PRINT_OFFSETS,
+ calls 'c_print_type_1', and then reenables FLAGS->PRINT_OFFSETS if
+ applicable. */
+
+static void
+c_print_type_no_offsets (struct type *type,
+ const char *varstring,
+ struct ui_file *stream,
+ int show, int level,
+ enum language language,
+ struct type_print_options *flags,
+ struct print_offset_data *podata)
+{
+ unsigned int old_po = flags->print_offsets;
+
+ /* Temporarily disable print_offsets, because it would mess with
+ indentation. */
+ flags->print_offsets = 0;
+ c_print_type_1 (type, varstring, stream, show, level, language, flags,
+ podata);
+ flags->print_offsets = old_po;
+}
+
+/* Helper for 'c_type_print_base' that handles structs and unions.
+ For a description of the arguments, see 'c_type_print_base'. */
+
+static void
+c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
+ int show, int level,
+ enum language language,
+ const struct type_print_options *flags,
+ struct print_offset_data *podata)
+{
+ struct type_print_options local_flags = *flags;
+ local_flags.local_typedefs = NULL;
+
+ std::unique_ptr<typedef_hash_table> hash_holder;
+ if (!flags->raw)
+ {
+ if (flags->local_typedefs)
+ local_flags.local_typedefs
+ = new typedef_hash_table (*flags->local_typedefs);
+ else
+ local_flags.local_typedefs = new typedef_hash_table ();
+
+ hash_holder.reset (local_flags.local_typedefs);
+ }
+
+ c_type_print_modifier (type, stream, 0, 1, language);
+ if (type->code () == TYPE_CODE_UNION)
+ fprintf_filtered (stream, "union ");
+ else if (TYPE_DECLARED_CLASS (type))
+ fprintf_filtered (stream, "class ");
+ else
+ fprintf_filtered (stream, "struct ");
+
+ /* Print the tag if it exists. The HP aCC compiler emits a
+ spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
+ enum}" tag for unnamed struct/union/enum's, which we don't
+ want to print. */
+ if (type->name () != NULL
+ && !startswith (type->name (), "{unnamed"))
+ {
+ /* When printing the tag name, we are still effectively
+ printing in the outer context, hence the use of FLAGS
+ here. */
+ print_name_maybe_canonical (type->name (), flags, stream);
+ if (show > 0)
+ fputs_filtered (" ", stream);
+ }
+
+ if (show < 0)
+ {
+ /* If we just printed a tag name, no need to print anything
+ else. */
+ if (type->name () == NULL)
+ fprintf_filtered (stream, "{...}");
+ }
+ else if (show > 0 || type->name () == NULL)
+ {
+ struct type *basetype;
+ int vptr_fieldno;
+
+ c_type_print_template_args (&local_flags, type, stream);
+
+ /* Add in template parameters when printing derivation info. */
+ if (local_flags.local_typedefs != NULL)
+ local_flags.local_typedefs->add_template_parameters (type);
+ cp_type_print_derivation_info (stream, type, &local_flags);
+
+ /* This holds just the global typedefs and the template
+ parameters. */
+ struct type_print_options semi_local_flags = *flags;
+ semi_local_flags.local_typedefs = NULL;
+
+ std::unique_ptr<typedef_hash_table> semi_holder;
+ if (local_flags.local_typedefs != nullptr)