/* Declarations for C++ name lookup routines.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
extern binding_entry binding_table_find (binding_table, tree);
extern void cxx_remember_type_decls (binding_table);
\f
-/* Datatype used to temporarily save C++ bindings (for implicit
- instantiations purposes and like). Implemented in decl.c. */
-typedef struct cxx_saved_binding cxx_saved_binding;
-
/* Datatype that represents binding established by a declaration between
a name and a C++ entity. */
typedef struct cxx_binding cxx_binding;
unsigned is_local : 1;
};
+/* Datatype used to temporarily save C++ bindings (for implicit
+ instantiations purposes and like). Implemented in decl.c. */
+typedef struct cxx_saved_binding GTY(())
+{
+ /* The name of the current binding. */
+ tree identifier;
+ /* The binding we're saving. */
+ cxx_binding *binding;
+ tree real_type_value;
+} cxx_saved_binding;
+
+DEF_VEC_GC_O(cxx_saved_binding);
+
extern tree identifier_type_value (tree);
extern void set_identifier_type_value (tree, tree);
extern void pop_binding (tree, tree);
-extern void clear_identifier_class_values (void);
extern tree constructor_name_full (tree);
extern tree constructor_name (tree);
extern bool constructor_name_p (tree, tree);
"template <>", this scope is always empty. */
} scope_kind;
+typedef struct cp_class_binding GTY(())
+{
+ cxx_binding base;
+ /* The bound name. */
+ tree identifier;
+} cp_class_binding;
+
+DEF_VEC_GC_O(cp_class_binding);
+
/* For each binding contour we allocate a binding_level structure
which records the names defined in that contour.
Contours include:
VALUE the common ancestor with this binding_level's namespace. */
tree using_directives;
- /* If this binding level is the binding level for a class, then
- class_shadowed is a TREE_LIST. The TREE_PURPOSE of each node
- is the name of an entity bound in the class. The TREE_TYPE is
- the DECL bound by this name in the class. */
- tree class_shadowed;
+ /* For the binding level corresponding to a class, the entities
+ declared in the class or its base classes. */
+ VEC(cp_class_binding) *class_shadowed;
/* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and
- is used for all binding levels. In addition the TREE_VALUE is the
- IDENTIFIER_TYPE_VALUE before we entered the class. */
+ is used for all binding levels. The TREE_PURPOSE is the name of
+ the entity, the TREE_TYPE is the associated type. In addition
+ the TREE_VALUE is the IDENTIFIER_TYPE_VALUE before we entered
+ the class. */
tree type_shadowed;
/* A TREE_LIST. Each TREE_VALUE is the LABEL_DECL for a local
TREE_LIST; the TREE_VALUE is the actual declaration. */
tree dead_vars_from_for;
+ /* STATEMENT_LIST for statements in this binding contour.
+ Only used at present for SK_CLEANUP temporary bindings. */
+ tree statement_list;
+
/* Binding depth at which this level began. */
int binding_depth;
/* The kind of scope that this object represents. However, a
SK_TEMPLATE_SPEC scope is represented with KIND set to
- SK_TEMPALTE_PARMS and EXPLICIT_SPEC_P set to true. */
+ SK_TEMPLATE_PARMS and EXPLICIT_SPEC_P set to true. */
ENUM_BITFIELD (scope_kind) kind : 4;
/* True if this scope is an SK_TEMPLATE_SPEC scope. This field is
only valid if KIND == SK_TEMPLATE_PARMS. */
- bool explicit_spec_p : 1;
+ BOOL_BITFIELD explicit_spec_p : 1;
/* true means make a BLOCK for this level regardless of all else. */
unsigned keep : 1;
extern void print_binding_level (cxx_scope *);
extern void push_to_top_level (void);
extern void pop_from_top_level (void);
-extern void maybe_push_to_top_level (int);
extern void pop_everything (void);
extern void keep_next_level (bool);
extern bool is_ancestor (tree, tree);
-extern void push_scope (tree);
+extern bool push_scope (tree);
extern void pop_scope (tree);
+extern void push_binding_level (struct cp_binding_level *);
\f
extern void push_namespace (tree);
extern void pop_namespace (void);
extern tree lookup_tag (enum tree_code, tree, cxx_scope *, int);
extern tree lookup_tag_reverse (tree, tree);
extern tree lookup_name (tree, int);
-extern tree lookup_name_real (tree, int, int, int, int);
+extern tree lookup_name_real (tree, int, int, bool, int, int);
+extern tree lookup_type_scope (tree);
extern tree namespace_binding (tree, tree);
extern void set_namespace_binding (tree, tree, tree);
extern tree lookup_namespace_name (tree, tree);
extern tree lookup_qualified_name (tree, tree, bool, bool);
extern tree lookup_name_nonclass (tree);
-extern tree lookup_function_nonclass (tree, tree);
-extern int push_class_binding (tree, tree);
+extern tree lookup_function_nonclass (tree, tree, bool);
+extern void push_local_binding (tree, tree, int);
extern bool pushdecl_class_level (tree);
extern tree pushdecl_namespace_level (tree);
extern bool push_class_level_binding (tree, tree);
extern void storetags (tree);
extern tree getdecls (void);
extern tree cp_namespace_decls (tree);
-extern void set_class_shadows (tree);
extern void set_decl_namespace (tree, tree, bool);
extern tree current_decl_namespace (void);
extern void push_decl_namespace (tree);
extern void pop_decl_namespace (void);
extern void do_namespace_alias (tree, tree);
-extern void do_toplevel_using_decl (tree);
-extern void do_local_using_decl (tree);
+extern void do_toplevel_using_decl (tree, tree, tree);
+extern void do_local_using_decl (tree, tree, tree);
extern tree do_class_using_decl (tree);
extern void do_using_directive (tree);
extern tree lookup_arg_dependent (tree, tree, tree);
extern bool is_associated_namespace (tree, tree);
extern void parse_using_directive (tree, tree);
-
+extern tree innermost_non_namespace_value (tree);
+extern cxx_binding *outer_binding (tree, cxx_binding *, bool);
/* Set *DECL to the (non-hidden) declaration for ID at global scope,
if present and return true; otherwise return false. */
get_global_value_if_present (tree id, tree *decl)
{
tree global_value = namespace_binding (id, global_namespace);
-
if (global_value)
*decl = global_value;
return global_value != NULL;