aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-04-22 13:33:12 -0700
committerBen Cheng <bccheng@google.com>2014-04-22 13:33:12 -0700
commite3cc64dec20832769406aa38cde83c7dd4194bf4 (patch)
treeef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/gcc/cp/mangle.c
parentf33c7b3122b1d7950efa88067c9a156229ba647b (diff)
downloadtoolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/gcc/cp/mangle.c')
-rw-r--r--gcc-4.9/gcc/cp/mangle.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/gcc-4.9/gcc/cp/mangle.c b/gcc-4.9/gcc/cp/mangle.c
index 251edb14d..da82dd6ac 100644
--- a/gcc-4.9/gcc/cp/mangle.c
+++ b/gcc-4.9/gcc/cp/mangle.c
@@ -180,7 +180,7 @@ static void write_unscoped_template_name (const tree);
static void write_nested_name (const tree);
static void write_prefix (const tree);
static void write_template_prefix (const tree);
-static void write_unqualified_name (const tree);
+static void write_unqualified_name (tree);
static void write_conversion_operator_name (const tree);
static void write_source_name (tree);
static void write_literal_operator_name (tree);
@@ -1195,7 +1195,7 @@ write_unqualified_id (tree identifier)
}
static void
-write_unqualified_name (const tree decl)
+write_unqualified_name (tree decl)
{
MANGLE_TRACE_TREE ("unqualified-name", decl);
@@ -1280,10 +1280,21 @@ write_unqualified_name (const tree decl)
write_source_name (DECL_NAME (decl));
}
- tree attrs = (TREE_CODE (decl) == TYPE_DECL
- ? TYPE_ATTRIBUTES (TREE_TYPE (decl))
- : DECL_ATTRIBUTES (decl));
- write_abi_tags (lookup_attribute ("abi_tag", attrs));
+ /* We use the ABI tags from the primary template, ignoring tags on any
+ specializations. This is necessary because C++ doesn't require a
+ specialization to be declared before it is used unless the use
+ requires a complete type, but we need to get the tags right on
+ incomplete types as well. */
+ if (tree tmpl = most_general_template (decl))
+ decl = DECL_TEMPLATE_RESULT (tmpl);
+ /* Don't crash on an unbound class template. */
+ if (decl)
+ {
+ tree attrs = (TREE_CODE (decl) == TYPE_DECL
+ ? TYPE_ATTRIBUTES (TREE_TYPE (decl))
+ : DECL_ATTRIBUTES (decl));
+ write_abi_tags (lookup_attribute ("abi_tag", attrs));
+ }
}
/* Write the unqualified-name for a conversion operator to TYPE. */