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/dwarf2out.c | |
parent | e98d0ceafcef5dc4ddaf9b8c5bd08b04a4e5fb5f (diff) | |
download | gcc-5101b304668b06b6ef938a0acc84ba03debc816a.tar.gz |
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/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6f04c753c26..9be55d8ff6d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6812,22 +6812,35 @@ modified_type_die (type, is_const_type, is_volatile_type, context_die) if (code != ERROR_MARK) { - type = build_type_variant (type, is_const_type, is_volatile_type); - - mod_type_die = lookup_type_die (type); - if (mod_type_die) - return mod_type_die; + tree qualified_type; + + /* See if we already have the appropriately qualified variant of + this type. */ + qualified_type + = get_qualified_type (type, + ((is_const_type ? TYPE_QUAL_CONST : 0) + | (is_volatile_type + ? TYPE_QUAL_VOLATILE : 0))); + /* If we do, then we can just use its DIE, if it exists. */ + if (qualified_type) + { + mod_type_die = lookup_type_die (qualified_type); + if (mod_type_die) + return mod_type_die; + } /* Handle C typedef types. */ - if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && DECL_ORIGINAL_TYPE (TYPE_NAME (type))) + if (qualified_type && TYPE_NAME (qualified_type) + && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL + && DECL_ORIGINAL_TYPE (TYPE_NAME (qualified_type))) { - tree dtype = TREE_TYPE (TYPE_NAME (type)); - if (type == dtype) + tree type_name = TYPE_NAME (qualified_type); + tree dtype = TREE_TYPE (type_name); + if (qualified_type == dtype) { /* For a named type, use the typedef. */ - gen_type_die (type, context_die); - mod_type_die = lookup_type_die (type); + gen_type_die (qualified_type, context_die); + mod_type_die = lookup_type_die (qualified_type); } else if (is_const_type < TYPE_READONLY (dtype) @@ -6835,7 +6848,7 @@ modified_type_die (type, is_const_type, is_volatile_type, context_die) /* cv-unqualified version of named type. Just use the unnamed type to which it refers. */ mod_type_die - = modified_type_die (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), + = modified_type_die (DECL_ORIGINAL_TYPE (type_name), is_const_type, is_volatile_type, context_die); /* Else cv-qualified version of named type; fall through. */ |