summaryrefslogtreecommitdiffstats
path: root/gcc/cp/name-lookup.h
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-27 16:44:05 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-27 16:44:05 +0000
commitdf2c7ecb54999c7d09b7d3fda550f66c8e46ccde (patch)
treed165f5d3ea36c74d1560aeb2b2e40406468c4db1 /gcc/cp/name-lookup.h
parenteace1293ec3b94a874158b67b08b41b0b5d91fdd (diff)
downloadppe42-gcc-df2c7ecb54999c7d09b7d3fda550f66c8e46ccde.tar.gz
ppe42-gcc-df2c7ecb54999c7d09b7d3fda550f66c8e46ccde.zip
* name-lookup.h (get_global_value_if_present): New function.
(is_typename_at_global_scope): Likewise. * except.c (do_begin_catch): Use get_global_value_if_present. (do_end_catch): Likewise. (do_allocate_exception): Likewise. (do_free_exception): Likewise. (build_throw): Likewise. * parser.c (cp_parser_member_declaration): Likewise. * rtti.c (throw_bad_cast): Likewise. (throw_bad_typeid): Likewise. * decl.c (check_tag_decl): Use is_typename_at_global_scope. (grokdeclarator): Likewise. * cp-tree.h (global_namespace): Move to name-lookup.h * call.c (call_builtin_trap): Tidy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71858 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.h')
-rw-r--r--gcc/cp/name-lookup.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 923f4806adc..04c6161dbc4 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -97,6 +97,9 @@ extern cxx_binding *cxx_binding_make (tree, tree);
extern void cxx_binding_free (cxx_binding *);
extern bool supplement_binding (cxx_binding *, tree);
+/* The tree node representing the global scope. */
+extern GTY(()) tree global_namespace;
+
/* True if SCOPE designates the global scope binding contour. */
#define global_scope_p(SCOPE) \
((SCOPE) == NAMESPACE_LEVEL (global_namespace))
@@ -107,4 +110,28 @@ extern cxx_binding *binding_for_name (cxx_scope *, tree);
extern tree namespace_binding (tree, tree);
extern void set_namespace_binding (tree, tree, tree);
+
+/* Set *DECL to the (non-hidden) declaration for ID at global scope,
+ if present and return true; otherwise return false. */
+
+static inline bool
+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;
+}
+
+/* True is the binding of IDENTIFIER at global scope names a type. */
+
+static inline bool
+is_typename_at_global_scope (tree id)
+{
+ tree global_value = namespace_binding (id, global_namespace);
+
+ return global_value && TREE_CODE (global_value) == TYPE_DECL;
+}
+
#endif /* GCC_CP_NAME_LOOKUP_H */
OpenPOWER on IntegriCloud