public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [incremental] Patch: FYI: fix up VAR_DECLs after lookup
@ 2007-12-15  0:16 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2007-12-15  0:16 UTC (permalink / raw)
  To: Gcc Patch List

I'm checking this in on the incremental-compiler branch.

This is sort of a lame patch -- it isn't really complete.  But, right
now I'm thinking it is more the direction I want to go: fix up decls
at lookup time, then (later) have a pass that smashes them back together.
I think this approach is maybe the only way to avoid hacking a lot of
c-common.c, which I'd rather avoid.

Tom

ChangeLog:
2007-12-14  Tom Tromey  <tromey@redhat.com>

	* c-decl.c (lookup_name): Wrap variables in a VIEW_CONVERT_EXPR.

Index: c-decl.c
===================================================================
--- c-decl.c	(revision 130936)
+++ c-decl.c	(working copy)
@@ -2956,9 +2956,21 @@
   struct c_binding *b = I_SYMBOL_BINDING (name);
   if (b && !b->invisible)
     {
+      tree result = b->decl;
       if (B_IN_FILE_SCOPE (b))
-	c_parser_lookup_callback (name, b->decl, false);
-      return b->decl;
+	{
+	  c_parser_lookup_callback (name, result, false);
+	  /* We should only need to handle smashed types for
+	     file-scope things.  */
+	  if (TREE_TYPE (result) != error_mark_node
+	      && TREE_CODE (result) == VAR_DECL)
+	    {
+	      tree newtype = C_SMASHED_TYPE_VARIANT (TREE_TYPE (result));
+	      if (newtype != TREE_TYPE (result))
+		result = build1 (VIEW_CONVERT_EXPR, newtype, result);
+	    }
+	}
+      return result;
     }
   c_parser_lookup_callback (name, NULL_TREE, false);
   return 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-14 23:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-15  0:16 [incremental] Patch: FYI: fix up VAR_DECLs after lookup Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).