aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@apple.com>2005-06-28 02:01:08 +0000
committerZiemowit Laski <zlaski@apple.com>2005-06-28 02:01:08 +0000
commita89176636a83c2e387188e2b739f3a4cf1c6f24b (patch)
tree4dc299720e3fd440e3139ea0c208910bedcceae5 /gcc/objc
parentc3e9d112d1d4fdd1610cf0668636daa50b0bfa0d (diff)
[gcc/objc/ChangeLog]
2005-06-27 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_build_struct): Save the TYPE_OBJC_INFO portion of TYPE_LANG_SPECIFIC info for all variants of a class before calling finish_struct(), and restore same TYPE_OBJC_INFO afterwards. [gcc/testsuite/ChangeLog] 2005-06-27 Ziemowit Laski <zlaski@apple.com> * obj-c++.dg/proto-lossage-5.mm: New. * objc.dg/proto-lossage-5.m: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@101368 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog7
-rw-r--r--gcc/objc/objc-act.c16
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 04a402b2d3c..57a326ade94 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,10 @@
+2005-06-27 Ziemowit Laski <zlaski@apple.com>
+
+ * objc-act.c (objc_build_struct): Save the TYPE_OBJC_INFO
+ portion of TYPE_LANG_SPECIFIC info for all variants of
+ a class before calling finish_struct(), and restore
+ same TYPE_OBJC_INFO afterwards.
+
2005-06-25 Kelley Cook <kcook@gcc.gnu.org>
* all files: Update FSF address in copyright headers.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 6c9018181da..35951fea145 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -801,6 +801,7 @@ objc_build_struct (tree name, tree fields, tree super_name)
{
tree s = start_struct (RECORD_TYPE, name);
tree super = (super_name ? xref_tag (RECORD_TYPE, super_name) : NULL_TREE);
+ tree t, objc_info = NULL_TREE;
if (super)
{
@@ -844,8 +845,23 @@ objc_build_struct (tree name, tree fields, tree super_name)
fields = base;
}
+ /* NB: Calling finish_struct() may cause type TYPE_LANG_SPECIFIC fields
+ in all variants of this RECORD_TYPE to be clobbered, but it is therein
+ that we store protocol conformance info (e.g., 'NSObject <MyProtocol>').
+ Hence, we must squirrel away the ObjC-specific information before calling
+ finish_struct(), and then reinstate it afterwards. */
+
+ for (t = TYPE_NEXT_VARIANT (s); t; t = TYPE_NEXT_VARIANT (t))
+ objc_info
+ = chainon (objc_info,
+ build_tree_list (NULL_TREE, TYPE_OBJC_INFO (t)));
+
s = finish_struct (s, fields, NULL_TREE);
+ for (t = TYPE_NEXT_VARIANT (s); t;
+ t = TYPE_NEXT_VARIANT (t), objc_info = TREE_CHAIN (objc_info))
+ TYPE_OBJC_INFO (t) = TREE_VALUE (objc_info);
+
/* Use TYPE_BINFO structures to point at the super class, if any. */
objc_xref_basetypes (s, super);