mirror of git://gcc.gnu.org/git/gcc.git
mangle.c (is_std_substitution): Check for abi_tag.
gcc/cp/ * mangle.c (is_std_substitution): Check for abi_tag. libiberty/ * cp-demangle.c (d_substitution): Handle abi tags on abbreviation. From-SVN: r215647
This commit is contained in:
parent
20ee26901f
commit
00eaaa5056
|
|
@ -1,3 +1,7 @@
|
||||||
|
2014-09-26 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* mangle.c (find_substitution): Use write_abi_tags.
|
||||||
|
|
||||||
2014-09-25 Marek Polacek <polacek@redhat.com>
|
2014-09-25 Marek Polacek <polacek@redhat.com>
|
||||||
|
|
||||||
PR c++/61945
|
PR c++/61945
|
||||||
|
|
|
||||||
|
|
@ -512,6 +512,7 @@ find_substitution (tree node)
|
||||||
const int size = vec_safe_length (G.substitutions);
|
const int size = vec_safe_length (G.substitutions);
|
||||||
tree decl;
|
tree decl;
|
||||||
tree type;
|
tree type;
|
||||||
|
const char *abbr = NULL;
|
||||||
|
|
||||||
if (DEBUG_MANGLE)
|
if (DEBUG_MANGLE)
|
||||||
fprintf (stderr, " ++ find_substitution (%s at %p)\n",
|
fprintf (stderr, " ++ find_substitution (%s at %p)\n",
|
||||||
|
|
@ -530,13 +531,10 @@ find_substitution (tree node)
|
||||||
if (decl
|
if (decl
|
||||||
&& is_std_substitution (decl, SUBID_ALLOCATOR)
|
&& is_std_substitution (decl, SUBID_ALLOCATOR)
|
||||||
&& !CLASSTYPE_USE_TEMPLATE (TREE_TYPE (decl)))
|
&& !CLASSTYPE_USE_TEMPLATE (TREE_TYPE (decl)))
|
||||||
{
|
abbr = "Sa";
|
||||||
write_string ("Sa");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for std::basic_string. */
|
/* Check for std::basic_string. */
|
||||||
if (decl && is_std_substitution (decl, SUBID_BASIC_STRING))
|
else if (decl && is_std_substitution (decl, SUBID_BASIC_STRING))
|
||||||
{
|
{
|
||||||
if (TYPE_P (node))
|
if (TYPE_P (node))
|
||||||
{
|
{
|
||||||
|
|
@ -555,22 +553,16 @@ find_substitution (tree node)
|
||||||
SUBID_CHAR_TRAITS)
|
SUBID_CHAR_TRAITS)
|
||||||
&& is_std_substitution_char (TREE_VEC_ELT (args, 2),
|
&& is_std_substitution_char (TREE_VEC_ELT (args, 2),
|
||||||
SUBID_ALLOCATOR))
|
SUBID_ALLOCATOR))
|
||||||
{
|
abbr = "Ss";
|
||||||
write_string ("Ss");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Substitute for the template name only if this isn't a type. */
|
/* Substitute for the template name only if this isn't a type. */
|
||||||
{
|
abbr = "Sb";
|
||||||
write_string ("Sb");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for basic_{i,o,io}stream. */
|
/* Check for basic_{i,o,io}stream. */
|
||||||
if (TYPE_P (node)
|
else if (TYPE_P (node)
|
||||||
&& cp_type_quals (type) == TYPE_UNQUALIFIED
|
&& cp_type_quals (type) == TYPE_UNQUALIFIED
|
||||||
&& CLASS_TYPE_P (type)
|
&& CLASS_TYPE_P (type)
|
||||||
&& CLASSTYPE_USE_TEMPLATE (type)
|
&& CLASSTYPE_USE_TEMPLATE (type)
|
||||||
|
|
@ -587,35 +579,29 @@ find_substitution (tree node)
|
||||||
{
|
{
|
||||||
/* Got them. Is this basic_istream? */
|
/* Got them. Is this basic_istream? */
|
||||||
if (is_std_substitution (decl, SUBID_BASIC_ISTREAM))
|
if (is_std_substitution (decl, SUBID_BASIC_ISTREAM))
|
||||||
{
|
abbr = "Si";
|
||||||
write_string ("Si");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* Or basic_ostream? */
|
/* Or basic_ostream? */
|
||||||
else if (is_std_substitution (decl, SUBID_BASIC_OSTREAM))
|
else if (is_std_substitution (decl, SUBID_BASIC_OSTREAM))
|
||||||
{
|
abbr = "So";
|
||||||
write_string ("So");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* Or basic_iostream? */
|
/* Or basic_iostream? */
|
||||||
else if (is_std_substitution (decl, SUBID_BASIC_IOSTREAM))
|
else if (is_std_substitution (decl, SUBID_BASIC_IOSTREAM))
|
||||||
{
|
abbr = "Sd";
|
||||||
write_string ("Sd");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for namespace std. */
|
/* Check for namespace std. */
|
||||||
if (decl && DECL_NAMESPACE_STD_P (decl))
|
else if (decl && DECL_NAMESPACE_STD_P (decl))
|
||||||
{
|
{
|
||||||
write_string ("St");
|
write_string ("St");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tree tags = NULL_TREE;
|
||||||
|
if (OVERLOAD_TYPE_P (node))
|
||||||
|
tags = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (type));
|
||||||
/* Now check the list of available substitutions for this mangling
|
/* Now check the list of available substitutions for this mangling
|
||||||
operation. */
|
operation. */
|
||||||
for (i = 0; i < size; ++i)
|
if (!abbr || tags) for (i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
tree candidate = (*G.substitutions)[i];
|
tree candidate = (*G.substitutions)[i];
|
||||||
/* NODE is a matched to a candidate if it's the same decl node or
|
/* NODE is a matched to a candidate if it's the same decl node or
|
||||||
|
|
@ -630,8 +616,19 @@ find_substitution (tree node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!abbr)
|
||||||
/* No substitution found. */
|
/* No substitution found. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
write_string (abbr);
|
||||||
|
if (tags)
|
||||||
|
{
|
||||||
|
/* If there are ABI tags on the abbreviation, it becomes
|
||||||
|
a substitution candidate. */
|
||||||
|
write_abi_tags (tags);
|
||||||
|
add_substitution (node);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
// { dg-final { scan-assembler "_Z1fSsB3fooS_" } }
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
template <class T> struct char_traits {};
|
||||||
|
template <class T> struct allocator {};
|
||||||
|
template <class T, class U, class V>
|
||||||
|
struct __attribute ((abi_tag ("foo"))) basic_string { };
|
||||||
|
typedef basic_string<char,char_traits<char>,allocator<char> > string;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f(std::string,std::string) {}
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2014-09-26 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* cp-demangle.c (d_substitution): Handle abi tags on abbreviation.
|
||||||
|
|
||||||
2014-09-26 Max Ostapenko <m.ostapenko@partner.samsung.com>
|
2014-09-26 Max Ostapenko <m.ostapenko@partner.samsung.com>
|
||||||
|
|
||||||
* pex-common.h (struct pex_funcs): Add new parameter for open_write field.
|
* pex-common.h (struct pex_funcs): Add new parameter for open_write field.
|
||||||
|
|
|
||||||
|
|
@ -3687,6 +3687,7 @@ d_substitution (struct d_info *di, int prefix)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
int len;
|
int len;
|
||||||
|
struct demangle_component *c;
|
||||||
|
|
||||||
if (p->set_last_name != NULL)
|
if (p->set_last_name != NULL)
|
||||||
di->last_name = d_make_sub (di, p->set_last_name,
|
di->last_name = d_make_sub (di, p->set_last_name,
|
||||||
|
|
@ -3702,7 +3703,15 @@ d_substitution (struct d_info *di, int prefix)
|
||||||
len = p->simple_len;
|
len = p->simple_len;
|
||||||
}
|
}
|
||||||
di->expansion += len;
|
di->expansion += len;
|
||||||
return d_make_sub (di, s, len);
|
c = d_make_sub (di, s, len);
|
||||||
|
if (d_peek_char (di) == 'B')
|
||||||
|
{
|
||||||
|
/* If there are ABI tags on the abbreviation, it becomes
|
||||||
|
a substitution candidate. */
|
||||||
|
c = d_abi_tags (di, c);
|
||||||
|
d_add_substitution (di, c);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4353,3 +4353,6 @@ xxx
|
||||||
_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z
|
_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z
|
||||||
_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z
|
_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z
|
||||||
_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z
|
_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z
|
||||||
|
--format=gnu-v3
|
||||||
|
_Z1fSsB3fooS_
|
||||||
|
f(std::string[abi:foo], std::string[abi:foo])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue