This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Using directives (again)
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Using directives (again)
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Thu, 03 May 2001 12:13:37 +0100
- CC: mark at codesourcery dot com
- Organization: Codesourcery LLC
Hi,
I've applied this as the obvious fix to the recent using directive
breakage. there are some other places that need to be told about it.
After reading a function, and before expanding it to rtl we
lower AGGR_INIT_EXPRs into CALL_EXPRs via a tree walk.
Oh for a uniform AST representation.
fully bootstrapped on both branch and mainline i686-pc-linux-gnu.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-05-03 Nathan Sidwell <nathan@codesourcery.com>
* dump.c (cp_dump_tree, USING_STMT case): New case.
* tree.c (cp_statement_code_p): Add USING_STMT.
* decl2.c (do_using_directive): Add the using directive statement.
* tree.c (walk_tree): Reformat an if block.
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.462
diff -c -3 -p -r1.462 decl2.c
*** decl2.c 2001/05/02 14:38:31 1.462
--- decl2.c 2001/05/03 08:02:10
*************** do_using_directive (namespace)
*** 5204,5209 ****
--- 5204,5211 ----
{
if (namespace == fake_std_node)
return;
+ if (building_stmt_tree ())
+ add_stmt (build_stmt (USING_STMT, namespace));
/* using namespace A::B::C; */
if (TREE_CODE (namespace) == SCOPE_REF)
Index: cp/dump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/dump.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 dump.c
*** dump.c 2001/03/28 11:01:36 1.54
--- dump.c 2001/05/03 08:02:10
*************** cp_dump_tree (di, t)
*** 252,257 ****
--- 252,263 ----
dump_next_stmt (di, t);
break;
+ case USING_STMT:
+ dump_stmt (di, t);
+ dump_child ("nmsp", USING_STMT_NAMESPACE (t));
+ dump_next_stmt (di, t);
+ break;
+
default:
break;
}
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.241
diff -c -3 -p -r1.241 tree.c
*** tree.c 2001/05/02 14:38:33 1.241
--- tree.c 2001/05/03 08:02:11
*************** cp_statement_code_p (code)
*** 1038,1043 ****
--- 1038,1044 ----
case TRY_BLOCK:
case HANDLER:
case EH_SPEC_BLOCK:
+ case USING_STMT:
return 1;
default:
*************** walk_tree (tp, func, data, htab)
*** 1188,1203 ****
if (!*tp)
return NULL_TREE;
! if (htab) {
! void **slot;
! /* Don't walk the same tree twice, if the user has requested that we
! avoid doing so. */
! if (htab_find (htab, *tp))
! return NULL_TREE;
! /* If we haven't already seen this node, add it to the table. */
! slot = htab_find_slot (htab, *tp, INSERT);
! *slot = *tp;
! }
/* Call the function. */
walk_subtrees = 1;
--- 1189,1206 ----
if (!*tp)
return NULL_TREE;
! if (htab)
! {
! void **slot;
!
! /* Don't walk the same tree twice, if the user has requested
! that we avoid doing so. */
! if (htab_find (htab, *tp))
! return NULL_TREE;
! /* If we haven't already seen this node, add it to the table. */
! slot = htab_find_slot (htab, *tp, INSERT);
! *slot = *tp;
! }
/* Call the function. */
walk_subtrees = 1;