summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-09 16:14:37 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-09 16:14:37 +0000
commitd4701f6c1a7673d43ac1687b1c6c856cfbf057cd (patch)
treeaf7983d092e390f212209b62a57e8d2eac7d8be6 /libiberty
parentbd7fb1f355568e00bec66b46bc3670fbcd007edb (diff)
downloadgcc-d4701f6c1a7673d43ac1687b1c6c856cfbf057cd.tar.gz
Add C++ attribute abi_tag and -Wabi-tag option.
gcc/ * attribs.c (lookup_attribute_spec): Handle getting a TREE_LIST. gcc/c-family/ * c.opt (Wabi-tag): New. gcc/cp/ * tree.c (cxx_attribute_table): Add abi_tag attribute. (check_abi_tag_redeclaration, handle_abi_tag_attribute): New. * class.c (find_abi_tags_r, check_abi_tags): New. (check_bases, check_field_decl): Call check_abi_tags. * decl.c (redeclaration_error_message): Call check_abi_tag_redeclaration. * mangle.c (tree_string_cmp, write_abi_tags): New. (write_unqualified_name): Call write_abi_tags. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_TAGGED_NAME. libiberty/ * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_TAGGED_NAME. (d_make_comp, d_find_pack, d_print_comp): Likewise. (d_abi_tags): New. (d_name): Call it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193367 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog7
-rw-r--r--libiberty/cp-demangle.c48
2 files changed, 50 insertions, 5 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 303dda23cae..af12cd86470 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,10 @@
+2012-11-09 Jason Merrill <jason@redhat.com>
+
+ * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_TAGGED_NAME.
+ (d_make_comp, d_find_pack, d_print_comp): Likewise.
+ (d_abi_tags): New.
+ (d_name): Call it.
+
2012-10-08 Jason Merrill <jason@redhat.com>
* cp-demangle.c (d_special_name, d_dump): Handle TH and TW.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 32df38c6024..86c77471200 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -508,6 +508,11 @@ d_dump (struct demangle_component *dc, int indent)
case DEMANGLE_COMPONENT_NAME:
printf ("name '%.*s'\n", dc->u.s_name.len, dc->u.s_name.s);
return;
+ case DEMANGLE_COMPONENT_TAGGED_NAME:
+ printf ("tagged name\n");
+ d_dump (dc->u.s_binary.left, indent + 2);
+ d_dump (dc->u.s_binary.right, indent + 2);
+ return;
case DEMANGLE_COMPONENT_TEMPLATE_PARAM:
printf ("template parameter %ld\n", dc->u.s_number.number);
return;
@@ -809,6 +814,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type,
case DEMANGLE_COMPONENT_QUAL_NAME:
case DEMANGLE_COMPONENT_LOCAL_NAME:
case DEMANGLE_COMPONENT_TYPED_NAME:
+ case DEMANGLE_COMPONENT_TAGGED_NAME:
case DEMANGLE_COMPONENT_TEMPLATE:
case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
@@ -1202,6 +1208,23 @@ d_encoding (struct d_info *di, int top_level)
}
}
+/* <tagged-name> ::= <name> B <source-name> */
+
+static struct demangle_component *
+d_abi_tags (struct d_info *di, struct demangle_component *dc)
+{
+ char peek;
+ while (peek = d_peek_char (di),
+ peek == 'B')
+ {
+ struct demangle_component *tag;
+ d_advance (di, 1);
+ tag = d_source_name (di);
+ dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag);
+ }
+ return dc;
+}
+
/* <name> ::= <nested-name>
::= <unscoped-name>
::= <unscoped-template-name> <template-args>
@@ -1223,14 +1246,17 @@ d_name (struct d_info *di)
switch (peek)
{
case 'N':
- return d_nested_name (di);
+ dc = d_nested_name (di);
+ break;
case 'Z':
- return d_local_name (di);
+ dc = d_local_name (di);
+ break;
case 'L':
case 'U':
- return d_unqualified_name (di);
+ dc = d_unqualified_name (di);
+ break;
case 'S':
{
@@ -1272,7 +1298,7 @@ d_name (struct d_info *di)
d_template_args (di));
}
- return dc;
+ break;
}
default:
@@ -1287,8 +1313,12 @@ d_name (struct d_info *di)
dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc,
d_template_args (di));
}
- return dc;
+ break;
}
+
+ if (d_peek_char (di) == 'B')
+ dc = d_abi_tags (di, dc);
+ return dc;
}
/* <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
@@ -3745,6 +3775,7 @@ d_find_pack (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_LAMBDA:
case DEMANGLE_COMPONENT_NAME:
+ case DEMANGLE_COMPONENT_TAGGED_NAME:
case DEMANGLE_COMPONENT_OPERATOR:
case DEMANGLE_COMPONENT_BUILTIN_TYPE:
case DEMANGLE_COMPONENT_SUB_STD:
@@ -3830,6 +3861,13 @@ d_print_comp (struct d_print_info *dpi, int options,
d_print_java_identifier (dpi, dc->u.s_name.s, dc->u.s_name.len);
return;
+ case DEMANGLE_COMPONENT_TAGGED_NAME:
+ d_print_comp (dpi, options, d_left (dc));
+ d_append_string (dpi, "[abi:");
+ d_print_comp (dpi, options, d_right (dc));
+ d_append_char (dpi, ']');
+ return;
+
case DEMANGLE_COMPONENT_QUAL_NAME:
case DEMANGLE_COMPONENT_LOCAL_NAME:
d_print_comp (dpi, options, d_left (dc));