Skip to content

Commit

Permalink
Use STRUCTOP_PTR instead of STRUCTOP_STRUCT for dot exps.
Browse files Browse the repository at this point in the history
With the later, you must do (*exp).foo() in order to call member
functions of an object located in memory.
  • Loading branch information
ibuclaw committed May 17, 2020
1 parent ddb55d1 commit a950985
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gdb/d-exp.y
Original file line number Diff line number Diff line change
Expand Up @@ -346,20 +346,20 @@ PostfixExpression:
| PostfixExpression '.' COMPLETE
{ struct stoken s;
pstate->mark_struct_expression ();
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
s.ptr = "";
s.length = 0;
write_exp_string (pstate, s);
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
write_exp_elt_opcode (pstate, STRUCTOP_PTR); }
| PostfixExpression '.' IDENTIFIER
{ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
{ write_exp_elt_opcode (pstate, STRUCTOP_PTR);
write_exp_string (pstate, $3);
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
write_exp_elt_opcode (pstate, STRUCTOP_PTR); }
| PostfixExpression '.' IDENTIFIER COMPLETE
{ pstate->mark_struct_expression ();
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
write_exp_string (pstate, $3);
write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
write_exp_elt_opcode (pstate, STRUCTOP_PTR); }
| PostfixExpression '.' SIZEOF_KEYWORD
{ write_exp_elt_opcode (pstate, UNOP_SIZEOF); }
| PostfixExpression INCREMENT
Expand Down

0 comments on commit a950985

Please sign in to comment.