aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-typeprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-11-12 17:14:55 +0000
committerTom Tromey <tromey@redhat.com>2012-11-12 17:14:55 +0000
commit79d43c6168cdc6f263988e7c2fad9d4c82b5cd42 (patch)
tree050bebf9539219612de38eec40ed9a52dfb48b38 /gdb/c-typeprint.c
parentb3720c3afd7fc68cf30b2ce40a8f0ccddc8f5069 (diff)
* ada-lang.c (user_select_syms, ada_print_subexp): Pass flags
to type-printing functions. * ada-lang.h (ada_print_type): Add argument. * ada-typeprint.c (print_array_type, print_variant_clauses, print_variant_part, print_selected_record_field_types, print_record_field_types, print_unchecked_union_type, print_func_type, ada_print_type): Add flags argument. (ada_print_typedef): Update. * c-exp.y (OPERATOR conversion_type_id): Update. * c-lang.h (c_print_type, c_type_print_base): Update. * c-typeprint.c (c_print_type, c_type_print_varspec_prefix, c_type_print_modifier, c_type_print_args, c_type_print_varspec_suffix, c_type_print_base): Add flags argument. * cp-valprint.c (cp_print_class_member): Update. * dwarf2read.c (dwarf2_compute_name): Update. * f-lang.h (f_print_type): Add argument. * f-typeprint.c (f_print_type): Add flags argument. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update. * go-lang.h (go_print_type): Add argument. * go-typeprint.c (go_print_type): Add flags argument. * jv-lang.h (java_print_type): Add argument. * jv-typeprint.c (java_type_print_base, java_print_type): Add flags argument. * language.c (unk_lang_print_type): Add flags argument. * language.h (struct language_defn) <la_print_type>: Add flags argument. (LA_PRINT_TYPE): Likewise. * m2-lang.h (m2_print_type): Add argument. * m2-typeprint.c (m2_print_type, m2_range, m2_typedef, m2_array, m2_pointer, m2_ref, m2_procedure, m2_long_set, m2_unbounded_array, m2_record_fields): Add flags argument. * p-lang.h (pascal_print_type, pascal_type_print_base, pascal_type_print_varspec_prefix): Add argument. * p-typeprint.c (pascal_print_type, pascal_type_print_varspec_prefix, pascal_print_func_args, pascal_type_print_varspec_suffix, pascal_type_print_base): Add flags argument. * symmisc.c (print_symbol): Update. * typeprint.c (type_print_raw_options, default_ptype_flags): New globals. (type_print): Update. * typeprint.h (struct type_print_options): New. (type_print_raw_options): Declare. (c_type_print_varspec_suffix, c_type_print_args): Add argument.
Diffstat (limited to 'gdb/c-typeprint.c')
-rw-r--r--gdb/c-typeprint.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index a43dfce707..def80b211a 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -37,7 +37,8 @@
static void c_type_print_varspec_prefix (struct type *,
struct ui_file *,
- int, int, int);
+ int, int, int,
+ const struct type_print_options *);
/* Print "const", "volatile", or address space modifiers. */
static void c_type_print_modifier (struct type *,
@@ -50,7 +51,8 @@ void
c_print_type (struct type *type,
const char *varstring,
struct ui_file *stream,
- int show, int level)
+ int show, int level,
+ const struct type_print_options *flags)
{
enum type_code code;
int demangled_args;
@@ -59,7 +61,7 @@ c_print_type (struct type *type,
if (show > 0)
CHECK_TYPEDEF (type);
- c_type_print_base (type, stream, show, level);
+ c_type_print_base (type, stream, show, level, flags);
code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets;
@@ -74,7 +76,8 @@ c_print_type (struct type *type,
|| code == TYPE_CODE_REF)))
fputs_filtered (" ", stream);
need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
- c_type_print_varspec_prefix (type, stream, show, 0, need_post_space);
+ c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
+ flags);
if (varstring != NULL)
{
@@ -85,7 +88,7 @@ c_print_type (struct type *type,
demangled_args = strchr (varstring, '(') != NULL;
c_type_print_varspec_suffix (type, stream, show,
- 0, demangled_args);
+ 0, demangled_args, flags);
}
}
@@ -232,7 +235,8 @@ static void
c_type_print_varspec_prefix (struct type *type,
struct ui_file *stream,
int show, int passed_a_ptr,
- int need_post_space)
+ int need_post_space,
+ const struct type_print_options *flags)
{
const char *name;
@@ -248,39 +252,39 @@ c_type_print_varspec_prefix (struct type *type,
{
case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 1, 1);
+ stream, show, 1, 1, flags);
fprintf_filtered (stream, "*");
c_type_print_modifier (type, stream, 1, need_post_space);
break;
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
if (name)
fputs_filtered (name, stream);
else
c_type_print_base (TYPE_DOMAIN_TYPE (type),
- stream, -1, passed_a_ptr);
+ stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
case TYPE_CODE_METHODPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
fprintf_filtered (stream, "(");
name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
if (name)
fputs_filtered (name, stream);
else
c_type_print_base (TYPE_DOMAIN_TYPE (type),
- stream, -1, passed_a_ptr);
+ stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
case TYPE_CODE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 1, 0);
+ stream, show, 1, 0, flags);
fprintf_filtered (stream, "&");
c_type_print_modifier (type, stream, 1, need_post_space);
break;
@@ -288,21 +292,21 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_ARRAY:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_TYPEDEF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, passed_a_ptr, 0);
+ stream, show, passed_a_ptr, 0, flags);
break;
case TYPE_CODE_UNDEF:
@@ -390,7 +394,8 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
void
c_type_print_args (struct type *type, struct ui_file *stream,
- int linkage_name, enum language language)
+ int linkage_name, enum language language,
+ const struct type_print_options *flags)
{
int i, len;
struct field *args;
@@ -428,9 +433,9 @@ c_type_print_args (struct type *type, struct ui_file *stream,
}
if (language == language_java)
- java_print_type (param_type, "", stream, -1, 0);
+ java_print_type (param_type, "", stream, -1, 0, flags);
else
- c_print_type (param_type, "", stream, -1, 0);
+ c_print_type (param_type, "", stream, -1, 0, flags);
printed_any = 1;
}
@@ -599,7 +604,8 @@ void
c_type_print_varspec_suffix (struct type *type,
struct ui_file *stream,
int show, int passed_a_ptr,
- int demangled_args)
+ int demangled_args,
+ const struct type_print_options *flags)
{
if (type == 0)
return;
@@ -627,25 +633,25 @@ c_type_print_varspec_suffix (struct type *type,
fprintf_filtered (stream, (is_vector ? ")))" : "]"));
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0);
+ show, 0, 0, flags);
}
break;
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0);
+ show, 0, 0, flags);
break;
case TYPE_CODE_METHODPTR:
fprintf_filtered (stream, ")");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0);
+ show, 0, 0, flags);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 1, 0);
+ show, 1, 0, flags);
break;
case TYPE_CODE_METHOD:
@@ -653,14 +659,15 @@ c_type_print_varspec_suffix (struct type *type,
if (passed_a_ptr)
fprintf_filtered (stream, ")");
if (!demangled_args)
- c_type_print_args (type, stream, 0, current_language->la_language);
+ c_type_print_args (type, stream, 0, current_language->la_language,
+ flags);
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, passed_a_ptr, 0);
+ show, passed_a_ptr, 0, flags);
break;
case TYPE_CODE_TYPEDEF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, passed_a_ptr, 0);
+ show, passed_a_ptr, 0, flags);
break;
case TYPE_CODE_UNDEF:
@@ -709,7 +716,7 @@ c_type_print_varspec_suffix (struct type *type,
void
c_type_print_base (struct type *type, struct ui_file *stream,
- int show, int level)
+ int show, int level, const struct type_print_options *flags)
{
int i;
int len, real_len;
@@ -765,7 +772,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
case TYPE_CODE_METHOD:
case TYPE_CODE_METHODPTR:
c_type_print_base (TYPE_TARGET_TYPE (type),
- stream, show, level);
+ stream, show, level, flags);
break;
case TYPE_CODE_STRUCT:
@@ -943,7 +950,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, "static ");
c_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
if (!field_is_static (&TYPE_FIELD (type, i))
&& TYPE_FIELD_PACKED (type, i))
{
@@ -1144,7 +1151,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
print_spaces_filtered (level + 4, stream);
fprintf_filtered (stream, "typedef ");
c_print_type (target, TYPE_TYPEDEF_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";\n");
}
}