aboutsummaryrefslogtreecommitdiff
path: root/gdb/d-exp.y
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2015-10-08 21:38:05 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2015-10-08 21:42:36 +0200
commitd5d8c4e12b220068fb0b2047b63562d3f9903e91 (patch)
tree614ae9c7a43abd282c7887310e6c22b31f2eb4f9 /gdb/d-exp.y
parent4e7de1556a25a3a31c53ea2242b1d9a5c103dd16 (diff)
downloadgdb-d5d8c4e12b220068fb0b2047b63562d3f9903e91.zip
gdb-d5d8c4e12b220068fb0b2047b63562d3f9903e91.tar.gz
gdb-d5d8c4e12b220068fb0b2047b63562d3f9903e91.tar.bz2
[D] Support D style sizeof and typeof expressions.
gdb/ChangeLog: * d-exp.y: (UnaryExpression): Support `type.sizeof' expressions. (PostfixExpression): Support `expr.sizeof' expressions. (PrimaryExpression): Support `typeof(expr)' expressions. gdb/testsuite/ChangeLog: * gdb.dlang/properties.exp: New file.
Diffstat (limited to 'gdb/d-exp.y')
-rw-r--r--gdb/d-exp.y6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index 30ff480..9e84a47 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -368,6 +368,8 @@ UnaryExpression:
{ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
| '~' UnaryExpression
{ write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
+| TypeExp '.' SIZEOF_KEYWORD
+ { write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
| CastExpression
| PowExpression
;
@@ -410,6 +412,8 @@ PostfixExpression:
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
write_exp_string (pstate, $3);
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
+| PostfixExpression '.' SIZEOF_KEYWORD
+ { write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
| PostfixExpression INCREMENT
{ write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); }
| PostfixExpression DECREMENT
@@ -616,6 +620,8 @@ PrimaryExpression:
write_exp_elt_longcst (pstate, (LONGEST) 0);
write_exp_elt_longcst (pstate, (LONGEST) $1 - 1);
write_exp_elt_opcode (pstate, OP_ARRAY); }
+| TYPEOF_KEYWORD '(' Expression ')'
+ { write_exp_elt_opcode (pstate, OP_TYPEOF); }
;
ArrayLiteral: