static void c_type_print_varspec_suffix (struct type *, struct ui_file *, int,
int, int,
+ enum language,
const struct type_print_options *);
static void c_type_print_varspec_prefix (struct type *,
struct ui_file *,
int, int, int,
+ enum language,
const struct type_print_options *,
struct print_offset_data *);
int, int);
static void c_type_print_base_1 (struct type *type, struct ui_file *stream,
- int show, int level,
+ int show, int level, enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata);
\f
const char *varstring,
struct ui_file *stream,
int show, int level,
+ enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata)
{
}
else
{
- c_type_print_base_1 (type, stream, show, level, flags, podata);
+ c_type_print_base_1 (type, stream, show, level, language, flags, podata);
code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets;
fputs_filtered (" ", stream);
need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
- flags, podata);
+ language, flags, podata);
}
if (varstring != NULL)
demangled_args = strchr (varstring, '(') != NULL;
c_type_print_varspec_suffix (type, stream, show,
0, demangled_args,
- flags);
+ language, flags);
}
}
}
{
struct print_offset_data podata;
- c_print_type_1 (type, varstring, stream, show, level, flags, &podata);
+ c_print_type_1 (type, varstring, stream, show, level,
+ current_language->la_language, flags, &podata);
+}
+
+
+/* See c-lang.h. */
+
+void
+c_print_type (struct type *type,
+ const char *varstring,
+ struct ui_file *stream,
+ int show, int level,
+ enum language language,
+ const struct type_print_options *flags)
+{
+ struct print_offset_data podata;
+
+ c_print_type_1 (type, varstring, stream, show, level, language, flags,
+ &podata);
}
/* Print a typedef using C syntax. TYPE is the underlying type.
cp_type_print_method_args (struct type *mtype, const char *prefix,
const char *varstring, int staticp,
struct ui_file *stream,
+ enum language language,
const struct type_print_options *flags)
{
struct field *args = TYPE_FIELDS (mtype);
}
else if (varargs)
fprintf_filtered (stream, "...");
- else if (current_language->la_language == language_cplus)
+ else if (language == language_cplus)
fprintf_filtered (stream, "void");
fprintf_filtered (stream, ")");
struct ui_file *stream,
int show, int passed_a_ptr,
int need_post_space,
+ enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata)
{
{
case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 1, 1, flags, podata);
+ stream, show, 1, 1, language, flags,
+ podata);
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, flags, podata);
+ stream, show, 0, 0, language, flags,
+ podata);
name = type_name_no_tag (TYPE_SELF_TYPE (type));
if (name)
print_name_maybe_canonical (name, flags, stream);
else
c_type_print_base_1 (TYPE_SELF_TYPE (type),
- stream, -1, passed_a_ptr, flags, podata);
+ stream, -1, passed_a_ptr, language, flags,
+ podata);
fprintf_filtered (stream, "::*");
break;
case TYPE_CODE_METHODPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0, flags, podata);
+ stream, show, 0, 0, language, flags,
+ podata);
fprintf_filtered (stream, "(");
name = type_name_no_tag (TYPE_SELF_TYPE (type));
if (name)
print_name_maybe_canonical (name, flags, stream);
else
c_type_print_base_1 (TYPE_SELF_TYPE (type),
- stream, -1, passed_a_ptr, flags, podata);
+ stream, -1, passed_a_ptr, language, flags,
+ podata);
fprintf_filtered (stream, "::*");
break;
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 1, 0, flags, podata);
+ stream, show, 1, 0, language, flags,
+ podata);
fprintf_filtered (stream, TYPE_CODE(type) == TYPE_CODE_REF ? "&" : "&&");
c_type_print_modifier (type, stream, 1, need_post_space);
break;
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0, flags, podata);
+ stream, show, 0, 0, language, flags,
+ podata);
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, flags, podata);
+ stream, show, 0, 0, language, flags,
+ podata);
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, flags,
- podata);
+ stream, show, passed_a_ptr, 0,
+ language, flags, podata);
break;
case TYPE_CODE_UNDEF:
param_type = make_cv_type (0, 0, param_type, NULL);
}
- c_print_type (param_type, "", stream, -1, 0, flags);
+ c_print_type (param_type, "", stream, -1, 0, language, flags);
printed_any = 1;
}
struct ui_file *stream,
int show, int passed_a_ptr,
int demangled_args,
+ enum language language,
const struct type_print_options *flags)
{
if (type == 0)
fprintf_filtered (stream, (is_vector ? ")))" : "]"));
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0, flags);
+ show, 0, 0, language, flags);
}
break;
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0, flags);
+ show, 0, 0, language, flags);
break;
case TYPE_CODE_METHODPTR:
fprintf_filtered (stream, ")");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0, flags);
+ show, 0, 0, language, flags);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 1, 0, flags);
+ show, 1, 0, language, flags);
break;
case TYPE_CODE_METHOD:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
if (!demangled_args)
- c_type_print_args (type, stream, 0, current_language->la_language,
- flags);
+ c_type_print_args (type, stream, 0, language, flags);
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, passed_a_ptr, 0, flags);
+ show, passed_a_ptr, 0, language, flags);
break;
case TYPE_CODE_TYPEDEF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, passed_a_ptr, 0, flags);
+ show, passed_a_ptr, 0, language, flags);
break;
case TYPE_CODE_UNDEF:
const char *varstring,
struct ui_file *stream,
int show, int level,
+ enum language language,
struct type_print_options *flags,
struct print_offset_data *podata)
{
/* Temporarily disable print_offsets, because it would mess with
indentation. */
flags->print_offsets = 0;
- c_print_type_1 (type, varstring, stream, show, level, flags, podata);
+ c_print_type_1 (type, varstring, stream, show, level, language, flags,
+ podata);
flags->print_offsets = old_po;
}
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)
{
c_print_type_1 (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, newshow, level + 4,
- &local_flags, &local_podata);
+ language, &local_flags, &local_podata);
if (!is_static && TYPE_FIELD_PACKED (type, i))
{
{
c_print_type_no_offsets
(TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
- "", stream, -1, 0, &local_flags, podata);
+ "", stream, -1, 0, language, &local_flags, podata);
fputs_filtered (" ", stream);
}
"",
method_name,
staticp,
- stream, &local_flags);
+ stream, language,
+ &local_flags);
}
else
fprintf_filtered (stream,
flags);
c_print_type_no_offsets (TYPE_NESTED_TYPES_FIELD_TYPE (type, i),
"", stream, show, level + 4,
- &semi_local_flags, podata);
+ language, &semi_local_flags, podata);
fprintf_filtered (stream, ";\n");
}
}
c_print_type_no_offsets (target,
TYPE_TYPEDEF_FIELD_NAME (type, i),
stream, show - 1, level + 4,
- &semi_local_flags, podata);
+ language, &semi_local_flags, podata);
fprintf_filtered (stream, ";\n");
}
}
static void
c_type_print_base_1 (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)
{
type_print_unknown_return_type (stream);
else
c_type_print_base_1 (TYPE_TARGET_TYPE (type),
- stream, show, level, flags, podata);
+ stream, show, level, language, flags, podata);
break;
case TYPE_CODE_ARRAY:
case TYPE_CODE_PTR:
case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_METHODPTR:
c_type_print_base_1 (TYPE_TARGET_TYPE (type),
- stream, show, level, flags, podata);
+ stream, show, level, language, flags, podata);
break;
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- c_type_print_base_struct_union (type, stream, show, level, flags,
- podata);
+ c_type_print_base_struct_union (type, stream, show, level,
+ language, flags, podata);
break;
case TYPE_CODE_ENUM:
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)
+ if (language == language_cplus && TYPE_TARGET_TYPE (type) != NULL)
{
struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type));
c_print_type_1 (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show, level + 4,
- &local_flags, podata);
+ language, &local_flags, podata);
fprintf_filtered (stream, " @%s",
plongest (TYPE_FIELD_BITPOS (type, i)));
if (TYPE_FIELD_BITSIZE (type, i) > 1)
{
struct print_offset_data podata;
- c_type_print_base_1 (type, stream, show, level, flags, &podata);
+ c_type_print_base_1 (type, stream, show, level,
+ current_language->la_language, flags, &podata);
}