diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-30 13:18:18 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-30 13:18:18 +0000 |
commit | 8546e57230f44350c7bdb77924f97194a4cfaeeb (patch) | |
tree | 77166001501020e6fe1d5e06685528945d95903b /gcc/cp/name-lookup.c | |
parent | 909d2cfeda0524661b48c364ca5836938275cc7b (diff) | |
download | gcc-8546e57230f44350c7bdb77924f97194a4cfaeeb.tar.gz |
* name-lookup.c: New file.
* name-lookup.h: Likewise..
* decl.c (push_binding): Adjust use cxx_binding_make.
(free_bindings): Move to name-lookup.c
(pop_binding): Use cxx_binding_free.
(binding_for_name): Tidy.
* cp-tree.h: Include "name-lookup.h"
(cxx_binding_make): Move to name-lookup.h
(cxx_binding_clear): Likewise.
(struct cxx_binding): Likewise.
(LOCAL_BINDING_P): Likewise.
(INHERITED_VALUE_BINDING_P): Likewise.
(BINDING_SCOPE): Likewise.
(BINDING_HAS_LEVEL_P): Likewise.
(BINDING_VALUE): Likewise.
(BINDING_TYPE): Likewise.
* config-lang.in (gtfiles): Add cp/name-lookup.h
* Make-lang.in (cp/name-lookup.o): New rule.
(CXX_OBJS): Add cp/name-lookup.o
(CXX_TREE_H): Add cp/name-lookup.h
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65040 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c new file mode 100644 index 00000000000..9153823c02f --- /dev/null +++ b/gcc/cp/name-lookup.c @@ -0,0 +1,58 @@ +/* Definitions for C++ name lookup routines. + Copyright (C) 2003 Free Software Foundation, Inc. + Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "cp-tree.h" +#include "name-lookup.h" + +/* A free list of "cxx_binding"s, connected by their PREVIOUS. */ +static GTY((deletable (""))) cxx_binding *free_bindings; + +/* (GC)-allocate a binding object with VALUE and TYPE member initialized. */ +cxx_binding * +cxx_binding_make (tree value, tree type) +{ + cxx_binding *binding; + if (free_bindings) + { + binding = free_bindings; + free_bindings = binding->previous; + } + else + binding = ggc_alloc (sizeof (cxx_binding)); + + binding->value = value; + binding->type = type; + + return binding; +} + +/* Put BINDING back on the free list. */ +void +cxx_binding_free (cxx_binding *binding) +{ + binding->previous = free_bindings; + free_bindings = binding; +} |