diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-11 22:27:26 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-11 22:27:26 +0000 |
commit | 6816d0c461d2fa52bffa30e4a7901091d134ac3c (patch) | |
tree | a99001a237dfd1caa78f3f3dd0c869a43f4fe759 /gcc/tree.c | |
parent | ca4b7618c8baba16ad5ad0b44ca4a1d452ddfeea (diff) | |
download | gcc-6816d0c461d2fa52bffa30e4a7901091d134ac3c.tar.gz |
2010-03-11 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43257
* tree.c (assign_assembler_name_if_neeeded): New function.
(free_lang_data_in_cgraph): Assembler name assignment moved to the
above new function.
* tree.h (assign_assembler_name_if_neeeded): Declare.
* cgraphunit.c (cgraph_analyze_function): Create an assembler name for
the function if needed.
* testsuite/g++.dg/torture/pr43257.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157393 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index c51cca7d6f7..86fe2bb3b62 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4831,6 +4831,33 @@ find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld) find_decls_types (v->decl, fld); } +/* If T needs an assembler name, have one created for it. */ + +void +assign_assembler_name_if_neeeded (tree t) +{ + if (need_assembler_name_p (t)) + { + /* When setting DECL_ASSEMBLER_NAME, the C++ mangler may emit + diagnostics that use input_location to show locus + information. The problem here is that, at this point, + input_location is generally anchored to the end of the file + (since the parser is long gone), so we don't have a good + position to pin it to. + + To alleviate this problem, this uses the location of T's + declaration. Examples of this are + testsuite/g++.dg/template/cond2.C and + testsuite/g++.dg/template/pr35240.C. */ + location_t saved_location = input_location; + input_location = DECL_SOURCE_LOCATION (t); + + decl_assembler_name (t); + + input_location = saved_location; + } +} + /* Free language specific information for every operand and expression in every node of the call graph. This process operates in three stages: @@ -4880,26 +4907,7 @@ free_lang_data_in_cgraph (void) now because free_lang_data_in_decl will invalidate data needed for mangling. This breaks mangling on interdependent decls. */ for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) - if (need_assembler_name_p (t)) - { - /* When setting DECL_ASSEMBLER_NAME, the C++ mangler may emit - diagnostics that use input_location to show locus - information. The problem here is that, at this point, - input_location is generally anchored to the end of the file - (since the parser is long gone), so we don't have a good - position to pin it to. - - To alleviate this problem, this uses the location of T's - declaration. Examples of this are - testsuite/g++.dg/template/cond2.C and - testsuite/g++.dg/template/pr35240.C. */ - location_t saved_location = input_location; - input_location = DECL_SOURCE_LOCATION (t); - - decl_assembler_name (t); - - input_location = saved_location; - } + assign_assembler_name_if_neeeded (t); /* Traverse every decl found freeing its language data. */ for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) |