diff options
author | Mark Mitchell <mark@codesourcery.com> | 2010-02-28 17:07:54 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2010-02-28 17:07:54 +0000 |
commit | 9625ce9c04435b640a7c04f0418c8a63655d58ff (patch) | |
tree | f2b4f7ef00102ad7b366dd23023b43367f88b2df /gcc/cp/mangle.c | |
parent | 65ff79d8851706205f37b59c38517c986ffe13e5 (diff) |
2010-02-27 Mark Mitchell <mark@codesourcery.com>
PR c++/42748
* cp-tree.h (push_tinst_level): Declare.
(pop_tinst_level): Likewise.
* pt.c (push_tinst_level): Give it external linkage.
(pop_tinst_level): Likewise.
* mangle.c (mangle_decl_string): Set the source location to that
of the decl while mangling.
2010-02-27 Mark Mitchell <mark@codesourcery.com>
PR c++/42748
* g++.dg/abi/mangle11.C: Adjust mangling warning locations.
* g++.dg/abi/mangle12.C: Likewise.
* g++.dg/abi/mangle20-2.C: Likewise.
* g++.dg/abi/mangle17.C: Likewise.
* g++.dg/template/cond2.C: Likewise.
* g++.dg/template/pr35240.C: Likewise.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@157124 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r-- | gcc/cp/mangle.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index e6d79342b0a..6196ae2edf6 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3008,6 +3008,22 @@ static tree mangle_decl_string (const tree decl) { tree result; + location_t saved_loc = input_location; + tree saved_fn = NULL_TREE; + bool template_p = false; + + if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) + { + struct tinst_level *tl = current_instantiation (); + if (!tl || tl->decl != decl) + { + template_p = true; + saved_fn = current_function_decl; + push_tinst_level (decl); + current_function_decl = NULL_TREE; + } + } + input_location = DECL_SOURCE_LOCATION (decl); start_mangling (decl); @@ -3020,6 +3036,14 @@ mangle_decl_string (const tree decl) if (DEBUG_MANGLE) fprintf (stderr, "mangle_decl_string = '%s'\n\n", IDENTIFIER_POINTER (result)); + + if (template_p) + { + pop_tinst_level (); + current_function_decl = saved_fn; + } + input_location = saved_loc; + return result; } |