aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/lex.cc')
-rw-r--r--gcc/cp/lex.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/cp/lex.cc b/gcc/cp/lex.cc
index 12af81e..08a6348 100644
--- a/gcc/cp/lex.cc
+++ b/gcc/cp/lex.cc
@@ -1082,15 +1082,17 @@ copy_lang_type (tree node)
if (! TYPE_LANG_SPECIFIC (node))
return;
- auto *lt = (struct lang_type *) ggc_internal_alloc (sizeof (struct lang_type));
+ size_t sz = (c_dialect_objc () ? sizeof (struct lang_type)
+ : offsetof (struct lang_type, info));
+ auto *lt = (struct lang_type *) ggc_internal_alloc (sz);
- memcpy (lt, TYPE_LANG_SPECIFIC (node), (sizeof (struct lang_type)));
+ memcpy (lt, TYPE_LANG_SPECIFIC (node), sz);
TYPE_LANG_SPECIFIC (node) = lt;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
+ tree_node_sizes[(int)lang_type] += sz;
}
}
@@ -1114,14 +1116,15 @@ maybe_add_lang_type_raw (tree t)
if (!RECORD_OR_UNION_CODE_P (TREE_CODE (t)))
return false;
- auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc
- (sizeof (struct lang_type)));
+ size_t sz = (c_dialect_objc () ? sizeof (struct lang_type)
+ : offsetof (struct lang_type, info));
+ auto *lt = (struct lang_type *) (ggc_internal_cleared_alloc (sz));
TYPE_LANG_SPECIFIC (t) = lt;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
+ tree_node_sizes[(int)lang_type] += sz;
}
return true;
@@ -1135,8 +1138,8 @@ cxx_make_type (enum tree_code code MEM_STAT_DECL)
if (maybe_add_lang_type_raw (t))
{
/* Set up some flags that give proper default behavior. */
- struct c_fileinfo *finfo =
- get_fileinfo (LOCATION_FILE (input_location));
+ struct c_fileinfo *finfo
+ = get_fileinfo (LOCATION_FILE (input_location));
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
}