diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-04-12 01:44:21 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-04-12 01:44:21 +0000 |
commit | 5101b304668b06b6ef938a0acc84ba03debc816a (patch) | |
tree | 897357278c2c9107171eee2fa55d88b0af494956 /gcc/tree.c | |
parent | e98d0ceafcef5dc4ddaf9b8c5bd08b04a4e5fb5f (diff) | |
download | gcc-5101b304668b06b6ef938a0acc84ba03debc816a.zip gcc-5101b304668b06b6ef938a0acc84ba03debc816a.tar.gz gcc-5101b304668b06b6ef938a0acc84ba03debc816a.tar.bz2 |
dwarf2out.c (modified_type_die): Don't create new types here.
* dwarf2out.c (modified_type_die): Don't create new types here.
* tree.h (get_qualified_type): New function.
(build_qualified_type): Adjust comment.
* tree.c (get_qualified_type): New function.
(build_qualified_type): Use it.
From-SVN: r41276
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 40 |
1 files changed, 28 insertions, 12 deletions
@@ -2993,31 +2993,47 @@ set_type_quals (type, type_quals) TYPE_RESTRICT (type) = (type_quals & TYPE_QUAL_RESTRICT) != 0; } -/* Given a type node TYPE and a TYPE_QUALIFIER_SET, return a type for - the same kind of data as TYPE describes. Variants point to the - "main variant" (which has no qualifiers set) via TYPE_MAIN_VARIANT, - and it points to a chain of other variants so that duplicate - variants are never made. Only main variants should ever appear as - types of expressions. */ +/* Return a version of the TYPE, qualified as indicated by the + TYPE_QUALS, if one exists. If no qualified version exists yet, + return NULL_TREE. */ tree -build_qualified_type (type, type_quals) +get_qualified_type (type, type_quals) tree type; int type_quals; { - register tree t; + tree t; /* Search the chain of variants to see if there is already one there just like the one we need to have. If so, use that existing one. We must preserve the TYPE_NAME, since there is code that depends on this. */ - for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type)) return t; - /* We need a new one. */ - t = build_type_copy (type); - set_type_quals (t, type_quals); + return NULL_TREE; +} + +/* Like get_qualified_type, but creates the type if it does not + exist. This function never returns NULL_TREE. */ + +tree +build_qualified_type (type, type_quals) + tree type; + int type_quals; +{ + tree t; + + /* See if we already have the appropriate qualified variant. */ + t = get_qualified_type (type, type_quals); + + /* If not, build it. */ + if (!t) + { + t = build_type_copy (type); + set_type_quals (t, type_quals); + } + return t; } |