This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[incremental] Patch: FYI: fix up VAR_DECLs after lookup
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Dec 2007 15:49:05 -0700
- Subject: [incremental] Patch: FYI: fix up VAR_DECLs after lookup
- Reply-to: Tom Tromey <tromey at redhat dot com>
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;