]> gcc.gnu.org Git - gcc.git/commitdiff
c++: better fixup_type_variants
authorNathan Sidwell <nathan@acm.org>
Tue, 28 Jul 2020 15:49:13 +0000 (08:49 -0700)
committerNathan Sidwell <nathan@acm.org>
Tue, 28 Jul 2020 16:01:31 +0000 (09:01 -0700)
fixup_type_variants was almost doing all that finish_struct needs.
May as well make it do it all.

gcc/cp/
* class.c (fixup_type_variants): Copy TYPE_SIZE and
TYPE_SIZE_UINIT.
(finish_struct): Call it.

gcc/cp/class.c

index ba96113bc8856acd258677a0e649be4e7c3d8892..7a25d8fc76c381ddfd3ae0f6bd551c6b36f1faff 100644 (file)
@@ -1967,6 +1967,9 @@ fixup_type_variants (tree t)
       /* Copy whatever these are holding today.  */
       TYPE_VFIELD (variants) = TYPE_VFIELD (t);
       TYPE_FIELDS (variants) = TYPE_FIELDS (t);
+
+      TYPE_SIZE (variants) = TYPE_SIZE (t);
+      TYPE_SIZE_UNIT (variants) = TYPE_SIZE_UNIT (t);
     }
 }
 
@@ -7610,12 +7613,7 @@ finish_struct (tree t, tree attributes)
        CLASSTYPE_NON_AGGREGATE (t) = 1;
 
       /* Fix up any variants we've already built.  */
-      for (x = TYPE_NEXT_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
-       {
-         TYPE_SIZE (x) = TYPE_SIZE (t);
-         TYPE_SIZE_UNIT (x) = TYPE_SIZE_UNIT (t);
-         TYPE_FIELDS (x) = TYPE_FIELDS (t);
-       }
+      fixup_type_variants (t);
     }
   else
     finish_struct_1 (t);
This page took 0.064072 seconds and 5 git commands to generate.