diff options
author | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
commit | e3cc64dec20832769406aa38cde83c7dd4194bf4 (patch) | |
tree | ef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/gcc/cp/mangle.c | |
parent | f33c7b3122b1d7950efa88067c9a156229ba647b (diff) | |
download | toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2 |
[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.c | 23 |
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 251edb1..da82dd6 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. */ |