+2020-12-14 Tom Tromey <tom@tromey.com>
+
+ * dtrace-probe.c (dtrace_process_dof_probe): Use value_type.
+ * typeprint.c (whatis_exp): Always use evaluate_type.
+ (maintenance_print_type): Likewise. Simplify.
+
2020-12-14 Tom Tromey <tromey@adacore.com>
* dictionary.c (language_defn::search_name_hash): Ignore "B".
"whatis" prints the type of the expression without stripping
any typedef level. "ptype" always strips all levels of
typedefs. */
+ val = evaluate_type (expr.get ());
+ type = value_type (val);
+
if (show == -1 && expr->elts[0].opcode == OP_TYPE)
{
/* The user expression names a type directly. */
- type = expr->elts[1].type;
/* If this is a typedef, then find its immediate target.
Use check_typedef to resolve stubs, but ignore its result
value to fetch the dynamic type from. */
val = NULL;
}
- else
- {
- /* The user expression names a type indirectly by naming an
- object or expression of that type. Find that
- indirectly-named type. */
- val = evaluate_type (expr.get ());
- type = value_type (val);
- }
}
else
{
void
maintenance_print_type (const char *type_name, int from_tty)
{
- struct value *val;
- struct type *type;
-
if (type_name != NULL)
{
expression_up expr = parse_expression (type_name);
- if (expr->elts[0].opcode == OP_TYPE)
- {
- /* The user expression names a type directly, just use that type. */
- type = expr->elts[1].type;
- }
- else
- {
- /* The user expression may name a type indirectly by naming an
- object of that type. Find that indirectly named type. */
- val = evaluate_type (expr.get ());
- type = value_type (val);
- }
- if (type != NULL)
- {
- recursive_dump_type (type, 0);
- }
+ struct value *val = evaluate_type (expr.get ());
+ struct type *type = value_type (val);
+
+ if (type != nullptr)
+ recursive_dump_type (type, 0);
}
}
\f