diff options
author | Jan Hubicka <jh@suse.cz> | 2011-06-10 20:28:02 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2011-06-10 18:28:02 +0000 |
commit | e44eb8ff70ccac139cb8c5c74532c2102ec07032 (patch) | |
tree | 9fa02cc0537003d6df4984db08d3496296b1de14 /gcc | |
parent | 264404492618e038a4686e6fd50d18802b2f9fa0 (diff) | |
download | gcc-e44eb8ff70ccac139cb8c5c74532c2102ec07032.zip gcc-e44eb8ff70ccac139cb8c5c74532c2102ec07032.tar.gz gcc-e44eb8ff70ccac139cb8c5c74532c2102ec07032.tar.bz2 |
decl2.c (clear_decl_external): New functoin.
* decl2.c (clear_decl_external): New functoin.
(cp_write_global_declarations): Use it.
From-SVN: r174922
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 36 |
2 files changed, 21 insertions, 20 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 116e470..c10db6c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-06-10 Jan Hubicka <jh@suse.cz> + + * decl2.c (clear_decl_external): New functoin. + (cp_write_global_declarations): Use it. + 2011-06-10 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.h (error_operand_p): Remove. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8eee458..82d0b11 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3635,6 +3635,15 @@ collect_all_refs (const char *source_file) collect_ada_namespace (global_namespace, source_file); } +/* Clear DECL_EXTERNAL for NODE. */ + +static bool +clear_decl_external (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) +{ + DECL_EXTERNAL (node->decl) = 0; + return false; +} + /* This routine is called at the end of compilation. Its job is to create all the code needed to initialize and destroy the global aggregates. We do the destruction @@ -3857,17 +3866,12 @@ cp_write_global_declarations (void) && DECL_INITIAL (decl) && decl_needed_p (decl)) { - struct cgraph_node *node = cgraph_get_node (decl), *alias, *next; + struct cgraph_node *node, *next; - DECL_EXTERNAL (decl) = 0; - /* If we mark !DECL_EXTERNAL one of the same body aliases, - we need to mark all of them that way. */ - if (node && node->same_body) - { - DECL_EXTERNAL (node->decl) = 0; - for (alias = node->same_body; alias; alias = alias->next) - DECL_EXTERNAL (alias->decl) = 0; - } + node = cgraph_get_node (decl); + + cgraph_for_node_and_aliases (node, clear_decl_external, + NULL, true); /* If we mark !DECL_EXTERNAL one of the symbols in some comdat group, we need to mark all symbols in the same comdat group that way. */ @@ -3875,16 +3879,8 @@ cp_write_global_declarations (void) for (next = node->same_comdat_group; next != node; next = next->same_comdat_group) - { - DECL_EXTERNAL (next->decl) = 0; - if (next->same_body) - { - for (alias = next->same_body; - alias; - alias = alias->next) - DECL_EXTERNAL (alias->decl) = 0; - } - } + cgraph_for_node_and_aliases (next, clear_decl_external, + NULL, true); } /* If we're going to need to write this function out, and |