summaryrefslogtreecommitdiff
path: root/libcc1
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-15 03:28:31 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-15 03:28:31 +0000
commita57c52b8d3231e21eb23c9a8d545551949b90751 (patch)
tree4d33781a146f21c9564a837fd95a447a96ac847c /libcc1
parentce326081d5bfd49f173a3a8f6549384e545be0ae (diff)
[libcp1] handle anon aggregates linkage-named by typedefs
Arrange for the first typedef to an anonymous type in the same context to be used as the linkage name for the type. for gcc/cp/ChangeLog * decl.c (name_unnamed_type): Split out of... (grokdeclarator): ... this. * decl.h (name_unnamed_type): Declare. for libcc1/ChangeLog * libcp1plugin.cc (plugin_build_decl): Call name_unnamed_type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246938 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcc1')
-rw-r--r--libcc1/ChangeLog4
-rw-r--r--libcc1/libcp1plugin.cc9
2 files changed, 13 insertions, 0 deletions
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index 5db05c58ba72..a6b9985e4ab5 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * libcp1plugin.cc (plugin_build_decl): Call name_unnamed_type.
+
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support.
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 545f28b98617..2464aa2f39d4 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -1494,6 +1494,15 @@ plugin_build_decl (cc1_plugin::connection *self,
set_access_flags (decl, acc_flags);
+ /* If this is the typedef that names an otherwise anonymous type,
+ propagate the typedef name to the type. In normal compilation,
+ this is done in grokdeclarator. */
+ if (sym_kind == GCC_CP_SYMBOL_TYPEDEF
+ && !template_decl_p
+ && DECL_CONTEXT (decl) == TYPE_CONTEXT (sym_type)
+ && TYPE_UNNAMED_P (sym_type))
+ name_unnamed_type (sym_type, decl);
+
if (sym_kind != GCC_CP_SYMBOL_TYPEDEF
&& sym_kind != GCC_CP_SYMBOL_CLASS
&& sym_kind != GCC_CP_SYMBOL_UNION