diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-12 23:34:09 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-12 23:34:09 +0000 |
commit | 03908818121d7f3e0bacb15f460eaf661b12c1a8 (patch) | |
tree | e0ba09b20b9401b57ddfd7bb96ac65cafde86a0b /gcc/tree-inline.c | |
parent | 536a6652af6d9edc775c6f153b35225dfde6c94e (diff) | |
download | gcc-03908818121d7f3e0bacb15f460eaf661b12c1a8.tar.gz |
PR c/24255
* tree.h (DECL_TRANSPARENT_UNION): Remove.
* function.c (assign_parm_find_data_types): Don't support it.
* print-tree.c (print_node): Likewise.
* c-common.c (handle_transparent_union_attribute): Likewise.
Use build_duplicate_type.
* tree-inline.c (remap_type_1): Split out of remap_type;
properly remap aggregate fields.
(build_duplicate_type): New.
* doc/extend.texi (Variable Attributes): Remove documentation
for transparent_union.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105338 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 74 |
1 files changed, 56 insertions, 18 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index f22785c0e80..0f7ea978b72 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -257,26 +257,10 @@ remap_decl (tree decl, inline_data *id) } static tree -remap_type (tree type, inline_data *id) +remap_type_1 (tree type, inline_data *id) { - splay_tree_node node; tree new, t; - if (type == NULL) - return type; - - /* See if we have remapped this type. */ - node = splay_tree_lookup (id->decl_map, (splay_tree_key) type); - if (node) - return (tree) node->value; - - /* The type only needs remapping if it's variably modified. */ - if (! variably_modified_type_p (type, id->callee)) - { - insert_decl_map (id, type, type); - return type; - } - /* We do need a copy. build and register it now. If this is a pointer or reference type, remap the designated type and make a new pointer or reference type. */ @@ -353,7 +337,18 @@ remap_type (tree type, inline_data *id) case RECORD_TYPE: case UNION_TYPE: case QUAL_UNION_TYPE: - walk_tree (&TYPE_FIELDS (new), copy_body_r, id, NULL); + { + tree f, nf = NULL; + + for (f = TYPE_FIELDS (new); f ; f = TREE_CHAIN (f)) + { + t = remap_decl (f, id); + DECL_CONTEXT (t) = new; + TREE_CHAIN (t) = nf; + nf = t; + } + TYPE_FIELDS (new) = nreverse (nf); + } break; case OFFSET_TYPE: @@ -369,6 +364,29 @@ remap_type (tree type, inline_data *id) } static tree +remap_type (tree type, inline_data *id) +{ + splay_tree_node node; + + if (type == NULL) + return type; + + /* See if we have remapped this type. */ + node = splay_tree_lookup (id->decl_map, (splay_tree_key) type); + if (node) + return (tree) node->value; + + /* The type only needs remapping if it's variably modified. */ + if (! variably_modified_type_p (type, id->callee)) + { + insert_decl_map (id, type, type); + return type; + } + + return remap_type_1 (type, id); +} + +static tree remap_decls (tree decls, inline_data *id) { tree old_var; @@ -2959,3 +2977,23 @@ inlining_p (inline_data * id) { return (!id->saving_p && !id->cloning_p && !id->versioning_p); } + +/* Duplicate a type, fields and all. */ + +tree +build_duplicate_type (tree type) +{ + inline_data id; + + memset (&id, 0, sizeof (id)); + id.callee = current_function_decl; + id.caller = current_function_decl; + id.callee_cfun = cfun; + id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); + + type = remap_type_1 (type, &id); + + splay_tree_delete (id.decl_map); + + return type; +} |