aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-09-29 13:59:08 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-09-29 13:59:08 +0000
commit725214ac5ecba8ec8c92dbc72d99579276d63a0d (patch)
tree2cbe7215d3413ac50b94430f2f38d095f618b315 /gcc/cp/name-lookup.c
parent085c1b4766696a735918705c56819cf4e71f4b15 (diff)
downloadgcc-725214ac5ecba8ec8c92dbc72d99579276d63a0d.zip
gcc-725214ac5ecba8ec8c92dbc72d99579276d63a0d.tar.gz
gcc-725214ac5ecba8ec8c92dbc72d99579276d63a0d.tar.bz2
tree.h (SCOPE_FILE_SCOPE_P): New macro.
2010-09-29 Richard Guenther <rguenther@suse.de> * tree.h (SCOPE_FILE_SCOPE_P): New macro. (DECL_FILE_SCOPE_P): Use it. (TYPE_FILE_SCOPE_P): New macro. cp/ * cp-tree.h (CP_DECL_CONTEXT): Check DECL_FILE_SCOPE_P. (CP_TYPE_CONTEXT): Similar. (FROB_CONTEXT): Frob global_namespace to the global TRANSLATION_UNIT_DECL. * decl.c (cxx_init_decl_processing): Build a TRANSLATION_UNIT_DECL, set DECL_CONTEXT of global_namespace to it. (start_decl): Use CP_DECL_CONTEXT and test TYPE_P instead of zeroing context. (cp_finish_decl): Use DECL_FILE_SCOPE_P. (grokfndecl): Likewise. (start_preparsed_function): Likewise. * name-lookup.c (maybe_push_decl): Use DECL_NAMESPACE_SCOPE_P. (namespace_binding): Use SCOPE_FILE_SCOPE_P. * pt.c (template_class_depth): Use CP_TYPE_CONTEXT. (is_specialization_of_friend): Use CP_DECL_CONTEXT. (push_template_decl_real): Likewise. (tsubst_friend_class): Likewise. Adjust context comparisons. (instantiate_class_template): Use CP_TYPE_CONTEXT. (tsubst): Do not substitute into TRANSLATION_UNIT_DECL. * cxx-pretty-print.c (pp_cxx_nested_name_specifier): Use SCOPE_FILE_SCOPE_P. From-SVN: r164719
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 41feb57..e980cb6 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1169,7 +1169,7 @@ maybe_push_decl (tree decl)
&& DECL_CONTEXT (decl) != NULL_TREE
/* Definitions of namespace members outside their namespace are
possible. */
- && TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL)
+ && !DECL_NAMESPACE_SCOPE_P (decl))
|| (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ())
|| type == unknown_type_node
/* The declaration of a template specialization does not affect
@@ -3068,7 +3068,7 @@ namespace_binding (tree name, tree scope)
{
cxx_binding *binding;
- if (scope == NULL)
+ if (SCOPE_FILE_SCOPE_P (scope))
scope = global_namespace;
else
/* Unnecessary for the global namespace because it can't be an alias. */