#include "c-lang.h"
#include "typeprint.h"
#include "cp-abi.h"
-#include "jv-lang.h"
#include "cp-support.h"
static void c_type_print_varspec_prefix (struct type *,
const struct type_print_options *flags,
struct ui_file *stream)
{
- char *s = NULL;
+ std::string s;
if (!flags->raw)
s = cp_canonicalize_string_full (name,
find_typedef_for_canonicalize,
(void *) flags);
- fputs_filtered (s ? s : name, stream);
- xfree (s);
+ fputs_filtered (!s.empty () ? s.c_str () : name, stream);
}
\f
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
+ case TYPE_CODE_FLAGS:
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
case TYPE_CODE_VOID:
parameter types get removed their possible const and volatile qualifiers to
match demangled linkage name parameters part of such function type.
LANGUAGE is the language in which TYPE was defined. This is a necessary
- evil since this code is used by the C, C++, and Java backends. */
+ evil since this code is used by the C and C++. */
void
c_type_print_args (struct type *type, struct ui_file *stream,
param_type = make_cv_type (0, 0, param_type, NULL);
}
- if (language == language_java)
- java_print_type (param_type, "", stream, -1, 0, flags);
- else
- c_print_type (param_type, "", stream, -1, 0, flags);
+ c_print_type (param_type, "", stream, -1, 0, flags);
printed_any = 1;
}
}
}
else if (!printed_any
- && ((TYPE_PROTOTYPED (type) && language != language_java)
- || language == language_cplus))
+ && (TYPE_PROTOTYPED (type) || language == language_cplus))
fprintf_filtered (stream, "void");
fprintf_filtered (stream, ")");
case TYPE_CODE_UNDEF:
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
+ case TYPE_CODE_FLAGS:
case TYPE_CODE_ENUM:
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0)
fprintf_filtered (stream, "\n");
- for (i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); i++)
- {
- struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i);
-
- /* Dereference the typedef declaration itself. */
- gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF);
- target = TYPE_TARGET_TYPE (target);
-
- print_spaces_filtered (level + 4, stream);
- fprintf_filtered (stream, "typedef ");
-
- /* We want to print typedefs with substitutions
- from the template parameters or globally-known
- typedefs but not local typedefs. */
- c_print_type (target,
- TYPE_TYPEDEF_FIELD_NAME (type, i),
- stream, show - 1, level + 4,
- &semi_local_flags);
- fprintf_filtered (stream, ";\n");
- }
- }
+ for (i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); i++)
+ {
+ struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i);
+
+ /* Dereference the typedef declaration itself. */
+ gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF);
+ target = TYPE_TARGET_TYPE (target);
+
+ print_spaces_filtered (level + 4, stream);
+ fprintf_filtered (stream, "typedef ");
+
+ /* We want to print typedefs with substitutions
+ from the template parameters or globally-known
+ typedefs but not local typedefs. */
+ c_print_type (target,
+ TYPE_TYPEDEF_FIELD_NAME (type, i),
+ stream, show - 1, level + 4,
+ &semi_local_flags);
+ fprintf_filtered (stream, ";\n");
+ }
+ }
fprintfi_filtered (level, stream, "}");
}
}
break;
+ case TYPE_CODE_FLAGS:
+ {
+ struct type_print_options local_flags = *flags;
+
+ local_flags.local_typedefs = NULL;
+
+ c_type_print_modifier (type, stream, 0, 1);
+ fprintf_filtered (stream, "flag ");
+ print_name_maybe_canonical (TYPE_NAME (type), flags, stream);
+ if (show > 0)
+ {
+ fputs_filtered (" ", stream);
+ fprintf_filtered (stream, "{\n");
+ if (TYPE_NFIELDS (type) == 0)
+ {
+ if (TYPE_STUB (type))
+ fprintfi_filtered (level + 4, stream,
+ _("<incomplete type>\n"));
+ else
+ fprintfi_filtered (level + 4, stream,
+ _("<no data fields>\n"));
+ }
+ len = TYPE_NFIELDS (type);
+ for (i = 0; i < len; i++)
+ {
+ QUIT;
+ print_spaces_filtered (level + 4, stream);
+ /* We pass "show" here and not "show - 1" to get enum types
+ printed. There's no other way to see them. */
+ c_print_type (TYPE_FIELD_TYPE (type, i),
+ TYPE_FIELD_NAME (type, i),
+ stream, show, level + 4,
+ &local_flags);
+ fprintf_filtered (stream, " @%s",
+ plongest (TYPE_FIELD_BITPOS (type, i)));
+ if (TYPE_FIELD_BITSIZE (type, i) > 1)
+ {
+ fprintf_filtered (stream, "-%s",
+ plongest (TYPE_FIELD_BITPOS (type, i)
+ + TYPE_FIELD_BITSIZE (type, i)
+ - 1));
+ }
+ fprintf_filtered (stream, ";\n");
+ }
+ fprintfi_filtered (level, stream, "}");
+ }
+ }
+ break;
+
case TYPE_CODE_VOID:
fprintf_filtered (stream, "void");
break;