aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1998-06-24 23:28:35 -0400
committerJason Merrill <jason@gcc.gnu.org>1998-06-24 23:28:35 -0400
commitcb0dbb9a01a4a3c2c2a5a94601b72c2c63cc2a51 (patch)
tree9200dfe8e80bc424f27eb57bd93f73389e249e39 /gcc/cp/decl2.c
parentacd9204960d4417b564e75ce036618359ce5eeda (diff)
downloadgcc-cb0dbb9a01a4a3c2c2a5a94601b72c2c63cc2a51.zip
gcc-cb0dbb9a01a4a3c2c2a5a94601b72c2c63cc2a51.tar.gz
gcc-cb0dbb9a01a4a3c2c2a5a94601b72c2c63cc2a51.tar.bz2
cp-tree.h (CP_DECL_CONTEXT): New macro.
* cp-tree.h (CP_DECL_CONTEXT): New macro. * decl2.c (is_namespace_ancestor, lookup_using_namespace): Use it. * method.c (build_overload_nested_name): Likewise. * sig.c (build_signature_pointer_or_reference_type): Don't set DECL_CONTEXT. Set DECL_CONTEXT for globals to NULL_TREE instead of global_namespace. * cp-tree.h (FROB_CONTEXT): New macro. (DECL_MAIN_P): ::main should have a DECL_CONTEXT of NULL_TREE. * decl.c (namespace_binding): Replace NULL_TREE with global_namespace. (set_namespace_binding, pop_namespace, lookup_name_real): Likewise. * decl2.c (is_namespace_ancestor, lookup_using_namespace): Likewise. * decl.c (pushtag): Use FROB_CONTEXT. (pushdecl, make_typename_type, define_function, grokdeclarator): Likewise. * decl2.c (set_decl_namespace, do_namespace_alias): Likewise. * pt.c (push_template_decl_real, lookup_template_class, tsubst): Likewise. * decl2.c (decl_namespace): Return global_namespace if no context. * method.c (build_overload_nested_name): Expect null as context. * pt.c (mangle_class_name_for_template): Do nothing for null contexts. (lookup_template_class): Allow for null id_context. From-SVN: r20710
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b3e3385..87f65fa 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3806,7 +3806,7 @@ is_namespace_ancestor (root, child)
return 1;
if (child == global_namespace)
return 0;
- return is_namespace_ancestor (root, DECL_CONTEXT (child));
+ return is_namespace_ancestor (root, CP_DECL_CONTEXT (child));
}
@@ -3950,7 +3950,7 @@ lookup_using_namespace (name, val, current, scope)
}
if (current == scope)
break;
- current = DECL_CONTEXT (current);
+ current = CP_DECL_CONTEXT (current);
}
return val != error_mark_node;
}
@@ -4013,7 +4013,7 @@ set_decl_namespace (decl, scope)
if (!is_namespace_ancestor (current_namespace, scope))
cp_error ("declaration of `%D' not in a namespace surrounding `%D'",
decl, scope);
- DECL_CONTEXT (decl) = scope;
+ DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
if (scope != current_namespace)
{
/* See whether this has been declared in the namespace. */
@@ -4056,9 +4056,7 @@ decl_namespace (decl)
my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', 390);
}
- /* We should always find the namespace. */
- my_friendly_abort (390);
- return NULL_TREE;
+ return global_namespace;
}
/* Return the namespace where the current declaration is declared. */
@@ -4388,7 +4386,7 @@ do_namespace_alias (alias, namespace)
/* Build the alias. */
alias = build_lang_decl (NAMESPACE_DECL, alias, void_type_node);
DECL_NAMESPACE_ALIAS (alias) = namespace;
- DECL_CONTEXT (alias) = current_namespace;
+ DECL_CONTEXT (alias) = FROB_CONTEXT (current_namespace);
BINDING_VALUE (binding) = alias;
}
}