+ /* We now want to restore the different TYPE_OBJC_INFO, but we
+ have the additional problem that the C frontend doesn't just
+ copy TYPE_LANG_SPECIFIC from one variant to the other; it
+ actually makes all of them the *same* TYPE_LANG_SPECIFIC. As
+ we need a different TYPE_OBJC_INFO for each (and
+ TYPE_OBJC_INFO is a field in TYPE_LANG_SPECIFIC), we need to
+ make a copy of each TYPE_LANG_SPECIFIC before we modify
+ TYPE_OBJC_INFO. */
+ if (TYPE_LANG_SPECIFIC (t))
+ {
+ /* Create a copy of TYPE_LANG_SPECIFIC. */
+ struct lang_type *old_lang_type = TYPE_LANG_SPECIFIC (t);
+ ALLOC_OBJC_TYPE_LANG_SPECIFIC (t);
+ memcpy (TYPE_LANG_SPECIFIC (t), old_lang_type,
+ SIZEOF_OBJC_TYPE_LANG_SPECIFIC);
+ }
+ else
+ {
+ /* Just create a new one. */
+ ALLOC_OBJC_TYPE_LANG_SPECIFIC (t);
+ }
+ /* Replace TYPE_OBJC_INFO with the saved one. This restores any
+ protocol information that may have been associated with the
+ type. */