diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-07-09 15:45:09 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-07-09 08:45:09 -0700 |
commit | 3ed8593d458fa2236988c3243547e99d2f46f7e7 (patch) | |
tree | 4ffe800b4c33c0db29f348e405ee0827f9871b15 /gcc/cp/cp-objcp-common.c | |
parent | 999a06a0da6405ea441a5079733906ffd3a441d4 (diff) | |
download | gcc-3ed8593d458fa2236988c3243547e99d2f46f7e7.tar.gz |
cp-lang.c (shadowed_var_for_decl, [...]): Move over to cp-objcp-common.c.
2005-07-09 Andrew Pinski <pinskia@physics.uc.edu>
* cp-lang.c (shadowed_var_for_decl, decl_shadowed_for_var_lookup,
decl_shadowed_for_var_insert): Move over to cp-objcp-common.c.
(cp_init_ts): Call init_shadowed_var_for_decl.
Remove include of gt-cp-cp-lang.h.
* cp-objcp-common.c (shadowed_var_for_decl,
decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Moved from
cp-lang.c.
(init_shadowed_var_for_decl): New function to initialize
shadowed_var_for_decl.
Include gt-cp-cp-objcp-common.h.
* Make-lang.in (gt-cp-lang.h): Remove.
(gt-cp-cp-objcp-common.h): Add.
(cp/cp-lang.o): Remove dependancy on gt-cp-lang.h.
(cp/cp-objcp-common.o): Add dependancy on gt-cp-cp-objcp-common.h.
* config-lang.in (gtfiles): Remove cp-lang.c and Add cp-objcp-common.c.
* cp-tree (init_shadowed_var_for_decl): Add prototype.
2005-07-09 Andrew Pinski <pinskia@physics.uc.edu>
* config-lang.in (gtfiles): Add cp-objcp-common.c.
* objcp-lang.c (objcxx_init_ts): New function.
(LANG_HOOKS_INIT_TS): Define.
From-SVN: r101830
Diffstat (limited to 'gcc/cp/cp-objcp-common.c')
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 0e29244fafd..43a7576bcd4 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -202,3 +202,47 @@ has_c_linkage (tree decl) { return DECL_EXTERN_C_P (decl); } + +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) + htab_t shadowed_var_for_decl; + +/* Lookup a shadowed var for FROM, and return it if we find one. */ + +tree +decl_shadowed_for_var_lookup (tree from) +{ + struct tree_map *h, in; + in.from = from; + + h = htab_find_with_hash (shadowed_var_for_decl, &in, + htab_hash_pointer (from)); + if (h) + return h->to; + return NULL_TREE; +} + +/* Insert a mapping FROM->TO in the shadowed var hashtable. */ + +void +decl_shadowed_for_var_insert (tree from, tree to) +{ + struct tree_map *h; + void **loc; + + h = ggc_alloc (sizeof (struct tree_map)); + h->hash = htab_hash_pointer (from); + h->from = from; + h->to = to; + loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, h->hash, INSERT); + *(struct tree_map **) loc = h; +} + +void +init_shadowed_var_for_decl (void) +{ + shadowed_var_for_decl = htab_create_ggc (512, tree_map_hash, + tree_map_eq, 0); +} + + +#include "gt-cp-cp-objcp-common.h" |