summaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-15 17:36:13 +0000
committerTom Tromey <tromey@redhat.com>2013-04-15 17:36:13 +0000
commit57b013f271b1191757b1d252774de9431fb2a546 (patch)
tree93742b172f22ef8513820786b1d62c80fddbe2e5 /gdb/c-exp.y
parent21b86ca972aef67d7a1bf2e5373af7d8bcb22e0d (diff)
downloadgdb-57b013f271b1191757b1d252774de9431fb2a546.tar.gz
PR c++/9065:
* NEWS: Update. * breakpoint.c (watchpoint_exp_is_const): Add OP_TYPEID. * c-exp.y (TYPEID): New token. (exp): Add new TYPEID productions. (ident_tokens): Add "typeid". * cp-abi.c (cplus_typeid, cplus_typeid_type): New functions. * cp-abi.h (cplus_typeid, cplus_typeid_type): Declare. (struct cp_abi_ops) <get_typeid, get_typeid_type>: New fields. * eval.c (evaluate_subexp_standard) <OP_TYPEID>: New case. * expprint.c (dump_subexp_body_standard) <OP_TYPEID>: New case. * gnu-v3-abi.c (std_type_info_gdbarch_data): New global. (build_std_type_info_type, gnuv3_get_typeid_type) (gnuv3_get_typeid): New functions. (init_gnuv3_ops): Initialize std_type_info_gdbarch_data. Set new fields on ABI object. * parse.c (operator_length_standard) <OP_TYPEID>: New case. * std-operator.def (OP_TYPEID): New. gdb/testsuite * gdb.cp/typeid.cc: New file. * gdb.cp/typeid.exp: New file.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y13
1 files changed, 12 insertions, 1 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index c3c7f1697ba..dd032d2ead0 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -234,6 +234,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
%token ENTRY
%token TYPEOF
%token DECLTYPE
+%token TYPEID
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
@@ -346,6 +347,14 @@ exp : exp DECREMENT %prec UNARY
{ write_exp_elt_opcode (UNOP_POSTDECREMENT); }
;
+exp : TYPEID '(' exp ')' %prec UNARY
+ { write_exp_elt_opcode (OP_TYPEID); }
+ ;
+
+exp : TYPEID '(' type_exp ')' %prec UNARY
+ { write_exp_elt_opcode (OP_TYPEID); }
+ ;
+
exp : SIZEOF exp %prec UNARY
{ write_exp_elt_opcode (UNOP_SIZEOF); }
;
@@ -2290,7 +2299,9 @@ static const struct token ident_tokens[] =
{"__typeof", TYPEOF, OP_TYPEOF, 0 },
{"typeof", TYPEOF, OP_TYPEOF, FLAG_SHADOW },
{"__decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX },
- {"decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX | FLAG_SHADOW }
+ {"decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX | FLAG_SHADOW },
+
+ {"typeid", TYPEID, OP_TYPEID, FLAG_CXX}
};
/* When we find that lexptr (the global var defined in parse.c) is