aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorArtemiy Volkov <artemiyv@acm.org>2017-03-20 13:47:43 -0700
committerKeith Seitz <keiths@redhat.com>2017-03-20 13:47:43 -0700
commit53cc15f5fe1f5e2358994d4f60f1c2aa9115004d (patch)
tree311f5e38f845699047db919a1addd12411f4b014 /gdb/c-exp.y
parenta65cfae5f8b268158c23a862e7a996d15bbcef0e (diff)
downloadgdb-53cc15f5fe1f5e2358994d4f60f1c2aa9115004d.zip
gdb-53cc15f5fe1f5e2358994d4f60f1c2aa9115004d.tar.gz
gdb-53cc15f5fe1f5e2358994d4f60f1c2aa9115004d.tar.bz2
Support rvalue reference type in parser
This patch implements correct parsing of C++11 rvalue reference typenames. This is done in full similarity to the handling of regular references by adding a '&&' token handling in c-exp.y, defining an rvalue reference type piece, and implementing a follow type derivation in follow_types(). gdb/ChangeLog PR gdb/14441 * c-exp.y (ptr_operator): Handle the '&&' token in the typename. * parse.c (insert_type): Change assert statement. (follow_types): Handle rvalue reference types. * parser-defs.h (enum type_pieces) <tp_rvalue_reference>: New constant.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 2753c6e..7c25641 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -744,7 +744,7 @@ exp : SIZEOF '(' type ')' %prec UNARY
says of sizeof: "When applied to a reference
or a reference type, the result is the size of
the referenced type." */
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type));
write_exp_elt_longcst (pstate,
(LONGEST) TYPE_LENGTH (type));
@@ -1085,6 +1085,10 @@ ptr_operator:
{ insert_type (tp_reference); }
| '&' ptr_operator
{ insert_type (tp_reference); }
+ | ANDAND
+ { insert_type (tp_rvalue_reference); }
+ | ANDAND ptr_operator
+ { insert_type (tp_rvalue_reference); }
;
ptr_operator_ts: ptr_operator