aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2007-05-06 00:01:36 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2007-05-06 00:01:36 +0000
commita2aa65f063a85d23f961337510d3a9395d79de41 (patch)
tree346b513c9858f2b4fdf34b115a7ccc9103a94c85 /gcc/cp/mangle.c
parentfabfde2e514c7125771651dc933bba9503bc0e67 (diff)
downloadgcc-a2aa65f063a85d23f961337510d3a9395d79de41.zip
gcc-a2aa65f063a85d23f961337510d3a9395d79de41.tar.gz
gcc-a2aa65f063a85d23f961337510d3a9395d79de41.tar.bz2
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. From-SVN: r124467
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 40c059a..31676e7 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));
}