From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/4] factor code
Date: Thu, 22 Nov 2012 07:33:00 -0000 [thread overview]
Message-ID: <1353569539-744-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1353569539-744-1-git-send-email-yao@codesourcery.com>
This is a code refactor to pave the way for the following patches.
Functionality of GDB is not affected.
gdb:
2012-11-22 Daniel Jacobowitz <dan@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* eval.c (evaluate_subexp_standard): Code factor.
---
gdb/eval.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index f655957..9957d02 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1364,7 +1364,6 @@ evaluate_subexp_standard (struct type *expect_type,
alloca (sizeof (struct value *) * (nargs + 3));
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
{
- nargs++;
/* First, evaluate the structure into arg2. */
pc2 = (*pos)++;
@@ -1388,22 +1387,22 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- if (TYPE_CODE (check_typedef (value_type (arg1)))
- != TYPE_CODE_METHODPTR)
- error (_("Non-pointer-to-member value used in pointer-to-member "
- "construct"));
-
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ type = check_typedef (value_type (arg1));
+ if (TYPE_CODE (type) == TYPE_CODE_METHODPTR)
{
- struct type *method_type = check_typedef (value_type (arg1));
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ arg1 = value_zero (type, not_lval);
+ else
+ arg1 = cplus_method_ptr_to_value (&arg2, arg1);
- arg1 = value_zero (method_type, not_lval);
+ /* Now, say which argument to start evaluating from. */
+ nargs++;
+ tem = 2;
+ argvec[1] = arg2;
}
else
- arg1 = cplus_method_ptr_to_value (&arg2, arg1);
-
- /* Now, say which argument to start evaluating from. */
- tem = 2;
+ error (_("Non-pointer-to-member value used in pointer-to-member "
+ "construct"));
}
else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
{
@@ -1654,7 +1653,7 @@ evaluate_subexp_standard (struct type *expect_type,
}
else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
{
- argvec[1] = arg2;
+ /* Pointer to member. argvec[1] is already set up. */
argvec[0] = arg1;
}
else if (op == OP_VAR_VALUE || (op == OP_SCOPE && function != NULL))
--
1.7.7.6
next prev parent reply other threads:[~2012-11-22 7:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 7:32 [PATCH 0/4] Fix member pointer bugs Yao Qi
2012-11-22 7:32 ` [PATCH 1/4] testcase - pointer to member function Yao Qi
2012-11-26 16:32 ` Tom Tromey
2012-11-22 7:33 ` [PATCH 4/4] Handle TYPE_CODE_MEMBERPTR Yao Qi
2012-11-22 8:07 ` Yao Qi
2012-11-26 16:42 ` Tom Tromey
2012-11-22 7:33 ` Yao Qi [this message]
2012-11-22 7:33 ` [PATCH 3/4] Use TYPE_TARGET_TYPE Yao Qi
2012-11-26 16:41 ` Tom Tromey
2012-11-27 8:03 ` [committed]: [PATCH 0/4] Fix member pointer bugs Yao Qi
2012-11-28 14:47 ` Tom Tromey
2012-11-28 15:14 ` Yao Qi
2012-11-28 16:37 ` Tom Tromey
2012-11-29 7:46 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353569539-744-3-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox