aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-05-04 15:39:05 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-05-04 15:39:05 +0000
commitad9870f2d507ce98df7e5daf57dfd6d7c4b16c50 (patch)
treed6b141e007885fa58515eaceac8d4000e96dcf94 /gcc/cp/decl.c
parent26f1a658e6308da5a7b804391c624acc3b1bee74 (diff)
downloadgcc-ad9870f2d507ce98df7e5daf57dfd6d7c4b16c50.zip
gcc-ad9870f2d507ce98df7e5daf57dfd6d7c4b16c50.tar.gz
gcc-ad9870f2d507ce98df7e5daf57dfd6d7c4b16c50.tar.bz2
More global trees.
* cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL, CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER, CPTI_INIT_LIST_IDENTIFIER. (global_namespace, global_type_node, global_identifier) anon_identifier, init_list_identifier): New. * decl.c (global_type_node, global_scope_name): Delete. (initialize_predefined_identifiers): Add new identifiers. (cxx_init_decl_processing): Adjust. * name-lookup.h (global_namespace, global_type_node): Delete. * name-lookup.c (global_namespace, anonymous_namespace_name) get_anonymous_namespace_name): Delete. (namespace_scope_ht_size, begin_scope, pushtag_1) push_namespace): Adjust, * call.c (type_has_extended_temps): Use init_list_identifier. * pt.c (listify): Likewise. (((--This line, and those below, will be ignored-- M cp/name-lookup.c M cp/name-lookup.h M cp/ChangeLog M cp/call.c M cp/pt.c M cp/cp-tree.h M cp/decl.c From-SVN: r247599
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4f06572..6a7aeb3 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -140,14 +140,6 @@ static void expand_static_init (tree, tree);
tree cp_global_trees[CPTI_MAX];
-/* Indicates that there is a type value in some namespace, although
- that is not necessarily in scope at the moment. */
-
-tree global_type_node;
-
-/* The node that holds the "name" of the global scope. */
-tree global_scope_name;
-
#define local_names cp_function_chain->x_local_names
/* A list of objects which have constructors or destructors
@@ -3935,7 +3927,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list,
-/* Push the declarations of builtin types into the namespace.
+/* Push the declarations of builtin types into the global namespace.
RID_INDEX is the index of the builtin type in the array
RID_POINTERS. NAME is the name used when looking up the builtin
type. TYPE is the _TYPE node for the builtin type. */
@@ -4037,10 +4029,15 @@ initialize_predefined_identifiers (void)
{ VTABLE_PFN_NAME, &pfn_identifier, 0 },
{ "_vptr", &vptr_identifier, 0 },
{ "__vtt_parm", &vtt_parm_identifier, 0 },
- { "::", &global_scope_name, 0 },
+ { "::", &global_identifier, 0 },
{ "std", &std_identifier, 0 },
+ /* The demangler expects anonymous namespaces to be called
+ something starting with '_GLOBAL__N_'. It no longer needs
+ to be unique to the TU. */
+ { "_GLOBAL__N_1", &anon_identifier, 0 },
{ "auto", &auto_identifier, 0 },
{ "decltype(auto)", &decltype_auto_identifier, 0 },
+ { "initializer_list", &init_list_identifier, 0 },
{ NULL, NULL, 0 }
};
@@ -4073,14 +4070,15 @@ cxx_init_decl_processing (void)
current_binding_level = NULL;
/* Enter the global namespace. */
gcc_assert (global_namespace == NULL_TREE);
- global_namespace = build_lang_decl (NAMESPACE_DECL, global_scope_name,
+ global_namespace = build_lang_decl (NAMESPACE_DECL, global_identifier,
void_type_node);
+ TREE_PUBLIC (global_namespace) = 1;
DECL_CONTEXT (global_namespace)
= build_translation_unit_decl (get_identifier (main_input_filename));
debug_hooks->register_main_translation_unit
(DECL_CONTEXT (global_namespace));
- TREE_PUBLIC (global_namespace) = 1;
begin_scope (sk_namespace, global_namespace);
+ current_namespace = global_namespace;
if (flag_visibility_ms_compat)
default_visibility = VISIBILITY_HIDDEN;