aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-01-18 20:54:35 +0000
committerTom Tromey <tromey@redhat.com>2010-01-18 20:54:35 +0000
commit4e8f195d9dd0be6a5caf9349883db5a531aabd5f (patch)
tree4135b82af0d720a7a7e9786de58cf7cfc9486885 /gdb/eval.c
parentd9c57d9ff1bf3533ddb272717afe2b18f61dd017 (diff)
downloadfsf-binutils-gdb-4e8f195d9dd0be6a5caf9349883db5a531aabd5f.zip
fsf-binutils-gdb-4e8f195d9dd0be6a5caf9349883db5a531aabd5f.tar.gz
fsf-binutils-gdb-4e8f195d9dd0be6a5caf9349883db5a531aabd5f.tar.bz2
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) <UNOP_DYNAMIC_CAST, UNOP_REINTERPRET_CAST>: 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.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 3dbbc8b..27b7895 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2413,6 +2413,22 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = value_cast (type, arg1);
return arg1;
+ case UNOP_DYNAMIC_CAST:
+ (*pos) += 2;
+ type = exp->elts[pc + 1].type;
+ arg1 = evaluate_subexp (type, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ return value_dynamic_cast (type, arg1);
+
+ case UNOP_REINTERPRET_CAST:
+ (*pos) += 2;
+ type = exp->elts[pc + 1].type;
+ arg1 = evaluate_subexp (type, exp, pos, noside);
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ return value_reinterpret_cast (type, arg1);
+
case UNOP_MEMVAL:
(*pos) += 2;
arg1 = evaluate_subexp (expect_type, exp, pos, noside);