Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: sami wagiaalla <swagiaal@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] function eval cleanup
Date: Mon, 12 Jul 2010 18:51:00 -0000	[thread overview]
Message-ID: <4C3B6428.8090906@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

This code performs function evaluation before overload resolution completes.

Currently, for C++, this is a waste if overload resolution results in a 
different function than the one which was evaluated but it breaks a 
future patch of mine which introduces a fake place holding variable 
needed for proper template function evaluation.

This patch cleans up the above

Sami Wagiaalla


[-- Attachment #2: overload-cleanup.patch --]
[-- Type: text/plain, Size: 1886 bytes --]

commit 9ae843b0376c83096f8d2d0fad5c94142209e8c3
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Tue Jun 22 12:19:08 2010 -0400

    Corrected pre-overload-resolution function evaluation.
    
    2010-07-12  Sami Wagiaalla  <swagiaal@redhat.com>
    
    	* eval.c (evaluate_subexp_standard): Disabled evaluation of C++
    	function symbols before overload resolution.

diff --git a/gdb/eval.c b/gdb/eval.c
index 9a60616..ea3d8a0 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1491,19 +1491,28 @@ evaluate_subexp_standard (struct type *expect_type,
 	{
 	  /* Non-method function call */
 	  save_pos1 = *pos;
-	  argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside);
 	  tem = 1;
-	  type = value_type (argvec[0]);
-	  if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
-	    type = TYPE_TARGET_TYPE (type);
-	  if (type && TYPE_CODE (type) == TYPE_CODE_FUNC)
+
+	  /* If this is a C++ function wait until overload resolution.  */
+	  if (overload_resolution
+	      && (exp->language_defn->la_language == language_cplus))
 	    {
-	      for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
+	      (*pos) += 4; /* Skip the evaluation of the symbol.  */
+	      argvec[0] = NULL;
+	    }
+	  else
+	    {
+	      argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside);
+	      type = value_type (argvec[0]);
+	      if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
+		type = TYPE_TARGET_TYPE (type);
+	      if (type && TYPE_CODE (type) == TYPE_CODE_FUNC)
 		{
-		  /* pai: FIXME This seems to be coercing arguments before
-		   * overload resolution has been done! */
-		  argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type, tem - 1),
-						 exp, pos, noside);
+		  for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
+		    {
+		      argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type, tem - 1),
+						     exp, pos, noside);
+		    }
 		}
 	    }
 	}

             reply	other threads:[~2010-07-12 18:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 18:51 sami wagiaalla [this message]
2010-07-14 23:00 ` Tom Tromey
2010-07-19 15:28   ` sami wagiaalla
2010-07-20 19:05     ` sami wagiaalla
2010-07-20 19:57       ` Tom Tromey

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=4C3B6428.8090906@redhat.com \
    --to=swagiaal@redhat.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