/* Support for printing C and C++ types for GDB, the GNU debugger.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "typeprint.h"
#include "cp-abi.h"
#include "jv-lang.h"
-#include <string.h>
-#include <errno.h>
#include "cp-support.h"
static void c_type_print_varspec_prefix (struct type *,
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 0, 0, flags);
- name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
+ name = type_name_no_tag (TYPE_SELF_TYPE (type));
if (name)
print_name_maybe_canonical (name, flags, stream);
else
- c_type_print_base (TYPE_DOMAIN_TYPE (type),
+ c_type_print_base (TYPE_SELF_TYPE (type),
stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 0, 0, flags);
fprintf_filtered (stream, "(");
- name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
+ name = type_name_no_tag (TYPE_SELF_TYPE (type));
if (name)
print_name_maybe_canonical (name, flags, stream);
else
- c_type_print_base (TYPE_DOMAIN_TYPE (type),
+ c_type_print_base (TYPE_SELF_TYPE (type),
stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
fprintf_filtered (stream, (is_vector ?
" __attribute__ ((vector_size(" : "["));
- if (get_array_bounds (type, &low_bound, &high_bound))
+ /* Bounds are not yet resolved, print a bounds placeholder instead. */
+ if (TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCEXPR
+ || TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCLIST)
+ fprintf_filtered (stream, "variable length");
+ else if (get_array_bounds (type, &low_bound, &high_bound))
fprintf_filtered (stream, "%s",
plongest (high_bound - low_bound + 1));
fprintf_filtered (stream, (is_vector ? ")))" : "]"));
case TYPE_CODE_ENUM:
c_type_print_modifier (type, stream, 0, 1);
fprintf_filtered (stream, "enum ");
+ if (TYPE_DECLARED_CLASS (type))
+ fprintf_filtered (stream, "class ");
/* Print the tag name if it exists.
The aCC compiler emits a spurious
"{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
{
LONGEST lastval = 0;
+ /* We can't handle this case perfectly, as DWARF does not
+ tell us whether or not the underlying type was specified
+ in the source (and other debug formats don't provide this
+ at all). We choose to print the underlying type, if it
+ has a name, when in C++ on the theory that it's better to
+ print too much than too little; but conversely not to
+ print something egregiously outside the current
+ language's syntax. */
+ if (current_language->la_language == language_cplus
+ && TYPE_TARGET_TYPE (type) != NULL)
+ {
+ struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type));
+
+ if (TYPE_NAME (underlying) != NULL)
+ fprintf_filtered (stream, ": %s ", TYPE_NAME (underlying));
+ }
+
fprintf_filtered (stream, "{");
len = TYPE_NFIELDS (type);
for (i = 0; i < len; i++)