summaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-06 00:01:36 +0000
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-06 00:01:36 +0000
commit9751796f97beaf7ea64712a6d6cd17b0f92c507a (patch)
tree346b513c9858f2b4fdf34b115a7ccc9103a94c85 /gcc/cp/mangle.c
parente53807b2bc628d068f10c772a1db337ddf0a11dd (diff)
downloadgcc-9751796f97beaf7ea64712a6d6cd17b0f92c507a.tar.gz
Index: libiberty/ChangeLog
2007-05-04 Geoffrey Keating <geoffk@apple.com> * cp-demangle.c (d_name): Detect local-source-name. (d_prefix): Likewise. (d_unqualified_name): Implement local-source-name. Index: gcc/cp/ChangeLog 2007-05-04 Geoffrey Keating <geoffk@apple.com> PR 31775 * mangle.c (write_mangled_name): Mangle static variable names. (write_unqualified_name): Use local-source-name for namespace-scope static variables. Index: gcc/testsuite/ChangeLog 2007-05-04 Geoffrey Keating <geoffk@apple.com> PR 31775 * g++.dg/other/nested-extern.cc: New. * g++.dg/other/nested-extern-1.C: New. * g++.dg/other/nested-extern-2.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124467 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 40c059ad63c..31676e7b454 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -688,7 +688,8 @@ write_mangled_name (const tree decl, bool top_level)
}
}
else if (TREE_CODE (decl) == VAR_DECL
- /* The names of global variables aren't mangled. */
+ /* The names of non-static global variables aren't mangled. */
+ && DECL_EXTERNAL_LINKAGE_P (decl)
&& (CP_DECL_CONTEXT (decl) == global_namespace
/* And neither are `extern "C"' variables. */
|| DECL_EXTERN_C_P (decl)))
@@ -1086,7 +1087,10 @@ write_template_prefix (const tree node)
<unqualified-name> ::= <operator-name>
::= <special-name>
- ::= <source-name> */
+ ::= <source-name>
+ ::= <local-source-name>
+
+ <local-source-name> ::= L <source-name> <discriminator> */
static void
write_unqualified_name (const tree decl)
@@ -1126,6 +1130,16 @@ write_unqualified_name (const tree decl)
write_string (oni[DECL_OVERLOADED_OPERATOR_P (decl)].mangled_name);
}
+ else if (VAR_OR_FUNCTION_DECL_P (decl) && ! TREE_PUBLIC (decl)
+ && DECL_NAMESPACE_SCOPE_P (decl)
+ && decl_linkage (decl) == lk_internal)
+ {
+ MANGLE_TRACE_TREE ("local-source-name", decl);
+ write_char ('L');
+ write_source_name (DECL_NAME (decl));
+ /* The default discriminator is 1, and that's all we ever use,
+ so there's no code to output one here. */
+ }
else
write_source_name (DECL_NAME (decl));
}