]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cp/name-lookup.h
mips-protos.h (mips_output_load_label): Declare.
[thirdparty/gcc.git] / gcc / cp / name-lookup.h
CommitLineData
aed81407
GDR
1/* Declarations for C++ name lookup routines.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
4
ed3cf953 5This file is part of GCC.
aed81407 6
ed3cf953 7GCC is free software; you can redistribute it and/or modify
aed81407
GDR
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
ed3cf953 12GCC is distributed in the hope that it will be useful,
aed81407
GDR
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
ed3cf953 18along with GCC; see the file COPYING. If not, write to
aed81407
GDR
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#ifndef GCC_CP_NAME_LOOKUP_H
23#define GCC_CP_NAME_LOOKUP_H
24
25#include "c-common.h"
26
5e0c54e5
GDR
27/* The type of dictionary used to map names to types declared at
28 a given scope. */
29typedef struct binding_table_s *binding_table;
30typedef struct binding_entry_s *binding_entry;
31
32/* The type of a routine repeatedly called by binding_table_foreach. */
33typedef void (*bt_foreach_proc) (binding_entry, void *);
34
35struct binding_entry_s GTY(())
36{
37 binding_entry chain;
38 tree name;
39 tree type;
40};
41
42/* These macros indicate the initial chains count for binding_table. */
43#define SCOPE_DEFAULT_HT_SIZE (1 << 3)
44#define CLASS_SCOPE_HT_SIZE (1 << 3)
45#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5)
46#define NAMESPACE_STD_HT_SIZE (1 << 8)
47#define GLOBAL_SCOPE_HT_SIZE (1 << 8)
48
49extern binding_table binding_table_new (size_t);
50extern void binding_table_free (binding_table);
51extern void binding_table_insert (binding_table, tree, tree);
52extern tree binding_table_find_anon_type (binding_table, tree);
53extern binding_entry binding_table_reverse_maybe_remap (binding_table,
54 tree, tree);
55extern void binding_table_remove_anonymous_types (binding_table);
56extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
57extern binding_entry binding_table_find (binding_table, tree);
58extern void cxx_remember_type_decls (binding_table);
59\f
aed81407
GDR
60/* Datatype used to temporarily save C++ bindings (for implicit
61 instantiations purposes and like). Implemented in decl.c. */
62typedef struct cxx_saved_binding cxx_saved_binding;
63
64/* Datatype that represents binding established by a declaration between
65 a name and a C++ entity. */
66typedef struct cxx_binding cxx_binding;
67
ed3cf953
GDR
68/* The datatype used to implement C++ scope. */
69typedef struct cp_binding_level cxx_scope;
70
aed81407
GDR
71/* Nonzero if this binding is for a local scope, as opposed to a class
72 or namespace scope. */
73#define LOCAL_BINDING_P(NODE) ((NODE)->is_local)
74
75/* Nonzero if BINDING_VALUE is from a base class of the class which is
76 currently being defined. */
77#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
78
79/* For a binding between a name and an entity at a non-local scope,
80 defines the scope where the binding is declared. (Either a class
ed3cf953
GDR
81 _TYPE node, or a NAMESPACE_DECL.). */
82#define BINDING_SCOPE(NODE) ((NODE)->scope)
aed81407
GDR
83
84/* This is the declaration bound to the name. Possible values:
85 variable, overloaded function, namespace, template, enumerator. */
86#define BINDING_VALUE(NODE) ((NODE)->value)
87
88/* If name is bound to a type, this is the type (struct, union, enum). */
89#define BINDING_TYPE(NODE) ((NODE)->type)
90
91/* Zero out a cxx_binding pointed to by B. */
92#define cxx_binding_clear(B) memset ((B), 0, sizeof (cxx_binding))
93
94struct cxx_binding GTY(())
95{
96 /* Link to chain together various bindings for this name. */
97 cxx_binding *previous;
98 /* The non-type entity this name is bound to. */
99 tree value;
100 /* The type entity this name is bound to. */
101 tree type;
ed3cf953
GDR
102 /* The scope at which this binding was made. */
103 cxx_scope *scope;
aed81407
GDR
104 unsigned value_is_inherited : 1;
105 unsigned is_local : 1;
106};
107
108extern cxx_binding *cxx_binding_make (tree, tree);
109extern void cxx_binding_free (cxx_binding *);
110\f
111
ed3cf953
GDR
112extern cxx_binding *cxx_scope_find_binding_for_name (cxx_scope *, tree);
113extern cxx_binding *binding_for_name (cxx_scope *, tree);
114\f
115extern tree namespace_binding (tree, tree);
116extern void set_namespace_binding (tree, tree, tree);
aed81407
GDR
117
118#endif /* GCC_CP_NAME_LOOKUP_H */