From 4e8f195d9dd0be6a5caf9349883db5a531aabd5f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 18 Jan 2010 20:54:35 +0000 Subject: gdb PR c++/9680: * c-exp.y (REINTERPRET_CAST, DYNAMIC_CAST, STATIC_CAST) (CONST_CAST): New tokens. (exp): Add new productions. (ident_tokens): Add const_cast, dynamic_cast, static_cast, and reinterpret_cast. (is_cast_operator): New function. (yylex): Handle cast operators specially. * eval.c (evaluate_subexp_standard) : New cases. * expprint.c (print_subexp_standard): Likewise. (op_name_standard): Likewise. (dump_subexp_body_standard): Likewise. * parse.c (operator_length_standard): Likewise. * expression.h (enum exp_opcode): New constants UNOP_DYNAMIC_CAST, UNOP_REINTERPRET_CAST. * gdbtypes.c (class_types_same_p): New function. (is_ancestor): Use it. (is_public_ancestor): New function. (is_unique_ancestor_worker): Likewise. (is_unique_ancestor): Likewise. * gdbtypes.h (class_types_same_p, is_public_ancestor) (is_unique_ancestor): Declare. * valops.c (value_reinterpret_cast): New function. (dynamic_cast_check_1): Likewise. (dynamic_cast_check_2): Likewise. (value_dynamic_cast): Likewise. * value.h (value_reinterpret_cast, value_dynamic_cast): Declare. gdb/testsuite PR c++/9680: * gdb.cp/casts.cc: Add new classes and variables. * gdb.cp/casts.exp: Test new operators. --- gdb/expression.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/expression.h') diff --git a/gdb/expression.h b/gdb/expression.h index e4e8598..ca216cf 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -233,6 +233,12 @@ enum exp_opcode It casts the value of the following subexpression. */ UNOP_CAST, + /* The C++ dynamic_cast operator. */ + UNOP_DYNAMIC_CAST, + + /* The C++ reinterpret_cast operator. */ + UNOP_REINTERPRET_CAST, + /* UNOP_MEMVAL is followed by a type pointer in the next exp_element With another UNOP_MEMVAL at the end, this makes three exp_elements. It casts the contents of the word addressed by the value of the -- cgit v1.1