Commit a98c0e91 by Mark Wielaard Committed by Mark Wielaard

dwarf2out.c: Pass one cv_quals argument instead of two for const and volatile.

modified_type_die and add_type_attribute take two separate arguments
for whether the type should be const and/or volatile. To help add
more type modifiers pass the requested modifiers as one cv_quals argument
to these functions. And introduce helper function decl_quals to extract
additional cv_quals from declaration trees.

DWARFv3 added restrict_type [PR debug/59051] and DWARFv5 has proposals
for atomic_type and aligned_type. Which will be easier to implement based
on this change.

gcc/ChangeLog

	* dwarf2out.c (decl_quals): New function.
	(modified_type_die): Take one cv_quals argument instead of two,
	one for const and one for volatile.
	(add_type_attribute): Likewise.
	(generic_parameter_die): Call add_type_attribute with one modifier
	argument.
	(base_type_for_mode): Likewise.
	(add_bounds_info): Likewise.
	(add_subscript_info): Likewise.
	(gen_array_type_die): Likewise.
	(gen_descr_array_type_die): Likewise.
	(gen_entry_point_die): Likewise.
	(gen_enumeration_type_die): Likewise.
	(gen_formal_parameter_die): Likewise.
	(gen_subprogram_die): Likewise.
	(gen_variable_die): Likewise.
	(gen_const_die): Likewise.
	(gen_field_die): Likewise.
	(gen_pointer_type_die): Likewise.
	(gen_reference_type_die): Likewise.
	(gen_ptr_to_mbr_type_die): Likewise.
	(gen_inheritance_die): Likewise.
	(gen_subroutine_type_die): Likewise.
	(gen_typedef_die): Likewise.
	(force_type_die): Likewise.

From-SVN: r214140
parent a6dad7b6
2014-07-07 Mark Wielaard <mjw@redhat.com>
* dwarf2out.c (decl_quals): New function.
(modified_type_die): Take one cv_quals argument instead of two,
one for const and one for volatile.
(add_type_attribute): Likewise.
(generic_parameter_die): Call add_type_attribute with one modifier
argument.
(base_type_for_mode): Likewise.
(add_bounds_info): Likewise.
(add_subscript_info): Likewise.
(gen_array_type_die): Likewise.
(gen_descr_array_type_die): Likewise.
(gen_entry_point_die): Likewise.
(gen_enumeration_type_die): Likewise.
(gen_formal_parameter_die): Likewise.
(gen_subprogram_die): Likewise.
(gen_variable_die): Likewise.
(gen_const_die): Likewise.
(gen_field_die): Likewise.
(gen_pointer_type_die): Likewise.
(gen_reference_type_die): Likewise.
(gen_ptr_to_mbr_type_die): Likewise.
(gen_inheritance_die): Likewise.
(gen_subroutine_type_die): Likewise.
(gen_typedef_die): Likewise.
(force_type_die): Likewise.
2014-08-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2014-08-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_as_comdat_group_group): Only default to no * configure.ac (gcc_cv_as_comdat_group_group): Only default to no
......
...@@ -3141,7 +3141,8 @@ static void output_file_names (void); ...@@ -3141,7 +3141,8 @@ static void output_file_names (void);
static dw_die_ref base_type_die (tree); static dw_die_ref base_type_die (tree);
static int is_base_type (tree); static int is_base_type (tree);
static dw_die_ref subrange_type_die (tree, tree, tree, dw_die_ref); static dw_die_ref subrange_type_die (tree, tree, tree, dw_die_ref);
static dw_die_ref modified_type_die (tree, int, int, dw_die_ref); static int decl_quals (const_tree);
static dw_die_ref modified_type_die (tree, int, dw_die_ref);
static dw_die_ref generic_parameter_die (tree, tree, bool, dw_die_ref); static dw_die_ref generic_parameter_die (tree, tree, bool, dw_die_ref);
static dw_die_ref template_parameter_pack_die (tree, tree, dw_die_ref); static dw_die_ref template_parameter_pack_die (tree, tree, dw_die_ref);
static int type_is_enum (const_tree); static int type_is_enum (const_tree);
...@@ -3199,7 +3200,7 @@ static dw_die_ref scope_die_for (tree, dw_die_ref); ...@@ -3199,7 +3200,7 @@ static dw_die_ref scope_die_for (tree, dw_die_ref);
static inline int local_scope_p (dw_die_ref); static inline int local_scope_p (dw_die_ref);
static inline int class_scope_p (dw_die_ref); static inline int class_scope_p (dw_die_ref);
static inline int class_or_namespace_scope_p (dw_die_ref); static inline int class_or_namespace_scope_p (dw_die_ref);
static void add_type_attribute (dw_die_ref, tree, int, int, dw_die_ref); static void add_type_attribute (dw_die_ref, tree, int, dw_die_ref);
static void add_calling_convention_attribute (dw_die_ref, tree); static void add_calling_convention_attribute (dw_die_ref, tree);
static const char *type_tag (const_tree); static const char *type_tag (const_tree);
static tree member_declared_type (const_tree); static tree member_declared_type (const_tree);
...@@ -10446,12 +10447,24 @@ subrange_type_die (tree type, tree low, tree high, dw_die_ref context_die) ...@@ -10446,12 +10447,24 @@ subrange_type_die (tree type, tree low, tree high, dw_die_ref context_die)
return subrange_die; return subrange_die;
} }
/* Returns the (const and/or volatile) cv_qualifiers associated with
the decl node. This will normally be augmented with the
cv_qualifiers of the underlying type in add_type_attribute. */
static int
decl_quals (const_tree decl)
{
return ((TREE_READONLY (decl)
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED)
| (TREE_THIS_VOLATILE (decl)
? TYPE_QUAL_VOLATILE : TYPE_UNQUALIFIED));
}
/* Given a pointer to an arbitrary ..._TYPE tree node, return a debugging /* Given a pointer to an arbitrary ..._TYPE tree node, return a debugging
entry that chains various modifiers in front of the given type. */ entry that chains various modifiers in front of the given type. */
static dw_die_ref static dw_die_ref
modified_type_die (tree type, int is_const_type, int is_volatile_type, modified_type_die (tree type, int cv_quals, dw_die_ref context_die)
dw_die_ref context_die)
{ {
enum tree_code code = TREE_CODE (type); enum tree_code code = TREE_CODE (type);
dw_die_ref mod_type_die; dw_die_ref mod_type_die;
...@@ -10464,12 +10477,12 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, ...@@ -10464,12 +10477,12 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
if (code == ERROR_MARK) if (code == ERROR_MARK)
return NULL; return NULL;
/* Only these cv-qualifiers are currently handled. */
cv_quals &= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
/* See if we already have the appropriately qualified variant of /* See if we already have the appropriately qualified variant of
this type. */ this type. */
qualified_type qualified_type = get_qualified_type (type, cv_quals);
= get_qualified_type (type,
((is_const_type ? TYPE_QUAL_CONST : 0)
| (is_volatile_type ? TYPE_QUAL_VOLATILE : 0)));
if (qualified_type == sizetype if (qualified_type == sizetype
&& TYPE_NAME (qualified_type) && TYPE_NAME (qualified_type)
...@@ -10507,35 +10520,38 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, ...@@ -10507,35 +10520,38 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
gen_type_die (qualified_type, context_die); gen_type_die (qualified_type, context_die);
return lookup_type_die (qualified_type); return lookup_type_die (qualified_type);
} }
else if (is_const_type < TYPE_READONLY (dtype) else
|| is_volatile_type < TYPE_VOLATILE (dtype) {
|| (is_const_type <= TYPE_READONLY (dtype) int dquals = TYPE_QUALS_NO_ADDR_SPACE (dtype);
&& is_volatile_type <= TYPE_VOLATILE (dtype) dquals &= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
&& DECL_ORIGINAL_TYPE (name) != type)) if ((dquals & ~cv_quals) != TYPE_UNQUALIFIED
/* cv-unqualified version of named type. Just use the unnamed || (cv_quals == dquals && DECL_ORIGINAL_TYPE (name) != type))
type to which it refers. */ /* cv-unqualified version of named type. Just use
the unnamed type to which it refers. */
return modified_type_die (DECL_ORIGINAL_TYPE (name), return modified_type_die (DECL_ORIGINAL_TYPE (name),
is_const_type, is_volatile_type, cv_quals, context_die);
context_die);
/* Else cv-qualified version of named type; fall through. */ /* Else cv-qualified version of named type; fall through. */
} }
}
mod_scope = scope_die_for (type, context_die); mod_scope = scope_die_for (type, context_die);
if (is_const_type if ((cv_quals & TYPE_QUAL_CONST)
/* If both is_const_type and is_volatile_type, prefer the path /* If both const_type and volatile_type, prefer the path
which leads to a qualified type. */ which leads to a qualified type. */
&& (!is_volatile_type && (!(cv_quals & TYPE_QUAL_VOLATILE)
|| get_qualified_type (type, TYPE_QUAL_CONST) == NULL_TREE || get_qualified_type (type, TYPE_QUAL_CONST) == NULL_TREE
|| get_qualified_type (type, TYPE_QUAL_VOLATILE) != NULL_TREE)) || get_qualified_type (type, TYPE_QUAL_VOLATILE) != NULL_TREE))
{ {
mod_type_die = new_die (DW_TAG_const_type, mod_scope, type); mod_type_die = new_die (DW_TAG_const_type, mod_scope, type);
sub_die = modified_type_die (type, 0, is_volatile_type, context_die); sub_die = modified_type_die (type, cv_quals & ~TYPE_QUAL_CONST,
context_die);
} }
else if (is_volatile_type) else if (cv_quals & TYPE_QUAL_VOLATILE)
{ {
mod_type_die = new_die (DW_TAG_volatile_type, mod_scope, type); mod_type_die = new_die (DW_TAG_volatile_type, mod_scope, type);
sub_die = modified_type_die (type, is_const_type, 0, context_die); sub_die = modified_type_die (type, cv_quals & ~TYPE_QUAL_VOLATILE,
context_die);
} }
else if (code == POINTER_TYPE) else if (code == POINTER_TYPE)
{ {
...@@ -10596,7 +10612,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, ...@@ -10596,7 +10612,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
if (name if (name
&& ((TREE_CODE (name) != TYPE_DECL && ((TREE_CODE (name) != TYPE_DECL
&& (qualified_type == TYPE_MAIN_VARIANT (type) && (qualified_type == TYPE_MAIN_VARIANT (type)
|| (!is_const_type && !is_volatile_type))) || (cv_quals == TYPE_UNQUALIFIED)))
|| (TREE_CODE (name) == TYPE_DECL || (TREE_CODE (name) == TYPE_DECL
&& TREE_TYPE (name) == qualified_type && TREE_TYPE (name) == qualified_type
&& DECL_NAME (name)))) && DECL_NAME (name))))
...@@ -10625,8 +10641,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, ...@@ -10625,8 +10641,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
recursion will terminate even if the type is recursive. Recursive recursion will terminate even if the type is recursive. Recursive
types are possible in Ada. */ types are possible in Ada. */
sub_die = modified_type_die (item_type, sub_die = modified_type_die (item_type,
TYPE_READONLY (item_type), TYPE_QUALS_NO_ADDR_SPACE (item_type),
TYPE_VOLATILE (item_type),
context_die); context_die);
if (sub_die != NULL) if (sub_die != NULL)
...@@ -10768,8 +10783,9 @@ generic_parameter_die (tree parm, tree arg, ...@@ -10768,8 +10783,9 @@ generic_parameter_die (tree parm, tree arg,
If PARM is a type generic parameter, TMPL_DIE should have a If PARM is a type generic parameter, TMPL_DIE should have a
child DW_AT_type that is set to ARG. */ child DW_AT_type that is set to ARG. */
tmpl_type = TYPE_P (arg) ? arg : TREE_TYPE (arg); tmpl_type = TYPE_P (arg) ? arg : TREE_TYPE (arg);
add_type_attribute (tmpl_die, tmpl_type, 0, add_type_attribute (tmpl_die, tmpl_type,
TREE_THIS_VOLATILE (tmpl_type), (TREE_THIS_VOLATILE (tmpl_type)
? TYPE_QUAL_VOLATILE : TYPE_UNQUALIFIED),
parent_die); parent_die);
} }
else else
...@@ -11511,7 +11527,7 @@ base_type_for_mode (enum machine_mode mode, bool unsignedp) ...@@ -11511,7 +11527,7 @@ base_type_for_mode (enum machine_mode mode, bool unsignedp)
} }
type_die = lookup_type_die (type); type_die = lookup_type_die (type);
if (!type_die) if (!type_die)
type_die = modified_type_die (type, false, false, comp_unit_die ()); type_die = modified_type_die (type, TYPE_UNQUALIFIED, comp_unit_die ());
if (type_die == NULL || type_die->die_tag != DW_TAG_base_type) if (type_die == NULL || type_die->die_tag != DW_TAG_base_type)
return NULL; return NULL;
return type_die; return type_die;
...@@ -16428,7 +16444,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b ...@@ -16428,7 +16444,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b
decl_die = new_die (DW_TAG_variable, ctx, bound); decl_die = new_die (DW_TAG_variable, ctx, bound);
add_AT_flag (decl_die, DW_AT_artificial, 1); add_AT_flag (decl_die, DW_AT_artificial, 1);
add_type_attribute (decl_die, TREE_TYPE (bound), 1, 0, ctx); add_type_attribute (decl_die, TREE_TYPE (bound), TYPE_QUAL_CONST, ctx);
add_AT_location_description (decl_die, DW_AT_location, list); add_AT_location_description (decl_die, DW_AT_location, list);
add_AT_die_ref (subrange_die, bound_attr, decl_die); add_AT_die_ref (subrange_die, bound_attr, decl_die);
break; break;
...@@ -16479,8 +16495,8 @@ add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p) ...@@ -16479,8 +16495,8 @@ add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p)
&& TYPE_NAME (TREE_TYPE (domain)) == NULL_TREE) && TYPE_NAME (TREE_TYPE (domain)) == NULL_TREE)
; ;
else else
add_type_attribute (subrange_die, TREE_TYPE (domain), 0, 0, add_type_attribute (subrange_die, TREE_TYPE (domain),
type_die); TYPE_UNQUALIFIED, type_die);
} }
/* ??? If upper is NULL, the array has unspecified length, /* ??? If upper is NULL, the array has unspecified length,
...@@ -16971,11 +16987,12 @@ class_or_namespace_scope_p (dw_die_ref context_die) ...@@ -16971,11 +16987,12 @@ class_or_namespace_scope_p (dw_die_ref context_die)
/* Many forms of DIEs require a "type description" attribute. This /* Many forms of DIEs require a "type description" attribute. This
routine locates the proper "type descriptor" die for the type given routine locates the proper "type descriptor" die for the type given
by 'type', and adds a DW_AT_type attribute below the given die. */ by 'type' plus any additional qualifiers given by 'cv_quals', and
adds a DW_AT_type attribute below the given die. */
static void static void
add_type_attribute (dw_die_ref object_die, tree type, int decl_const, add_type_attribute (dw_die_ref object_die, tree type, int cv_quals,
int decl_volatile, dw_die_ref context_die) dw_die_ref context_die)
{ {
enum tree_code code = TREE_CODE (type); enum tree_code code = TREE_CODE (type);
dw_die_ref type_die = NULL; dw_die_ref type_die = NULL;
...@@ -16996,8 +17013,7 @@ add_type_attribute (dw_die_ref object_die, tree type, int decl_const, ...@@ -16996,8 +17013,7 @@ add_type_attribute (dw_die_ref object_die, tree type, int decl_const,
return; return;
type_die = modified_type_die (type, type_die = modified_type_die (type,
decl_const || TYPE_READONLY (type), cv_quals | TYPE_QUALS_NO_ADDR_SPACE (type),
decl_volatile || TYPE_VOLATILE (type),
context_die); context_die);
if (type_die != NULL) if (type_die != NULL)
...@@ -17211,7 +17227,7 @@ gen_array_type_die (tree type, dw_die_ref context_die) ...@@ -17211,7 +17227,7 @@ gen_array_type_die (tree type, dw_die_ref context_die)
element_type = TREE_TYPE (element_type); element_type = TREE_TYPE (element_type);
} }
add_type_attribute (array_die, element_type, 0, 0, context_die); add_type_attribute (array_die, element_type, TYPE_UNQUALIFIED, context_die);
add_gnat_descriptive_type_attribute (array_die, type, context_die); add_gnat_descriptive_type_attribute (array_die, type, context_die);
if (TYPE_ARTIFICIAL (type)) if (TYPE_ARTIFICIAL (type))
...@@ -17374,7 +17390,8 @@ gen_descr_array_type_die (tree type, struct array_descr_info *info, ...@@ -17374,7 +17390,8 @@ gen_descr_array_type_die (tree type, struct array_descr_info *info,
} }
gen_type_die (info->element_type, context_die); gen_type_die (info->element_type, context_die);
add_type_attribute (array_die, info->element_type, 0, 0, context_die); add_type_attribute (array_die, info->element_type, TYPE_UNQUALIFIED,
context_die);
if (get_AT (array_die, DW_AT_name)) if (get_AT (array_die, DW_AT_name))
add_pubtype (type, array_die); add_pubtype (type, array_die);
...@@ -17393,7 +17410,7 @@ gen_entry_point_die (tree decl, dw_die_ref context_die) ...@@ -17393,7 +17410,7 @@ gen_entry_point_die (tree decl, dw_die_ref context_die)
{ {
add_name_and_src_coords_attributes (decl_die, decl); add_name_and_src_coords_attributes (decl_die, decl);
add_type_attribute (decl_die, TREE_TYPE (TREE_TYPE (decl)), add_type_attribute (decl_die, TREE_TYPE (TREE_TYPE (decl)),
0, 0, context_die); TYPE_UNQUALIFIED, context_die);
} }
if (DECL_ABSTRACT (decl)) if (DECL_ABSTRACT (decl))
...@@ -17483,7 +17500,8 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die) ...@@ -17483,7 +17500,8 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
if (dwarf_version >= 3 || !dwarf_strict) if (dwarf_version >= 3 || !dwarf_strict)
{ {
tree underlying = lang_hooks.types.enum_underlying_base_type (type); tree underlying = lang_hooks.types.enum_underlying_base_type (type);
add_type_attribute (type_die, underlying, 0, 0, context_die); add_type_attribute (type_die, underlying, TYPE_UNQUALIFIED,
context_die);
} }
if (TYPE_STUB_DECL (type) != NULL_TREE) if (TYPE_STUB_DECL (type) != NULL_TREE)
{ {
...@@ -17584,12 +17602,11 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, ...@@ -17584,12 +17602,11 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p,
{ {
tree type = TREE_TYPE (node_or_origin); tree type = TREE_TYPE (node_or_origin);
if (decl_by_reference_p (node_or_origin)) if (decl_by_reference_p (node_or_origin))
add_type_attribute (parm_die, TREE_TYPE (type), 0, 0, add_type_attribute (parm_die, TREE_TYPE (type),
context_die); TYPE_UNQUALIFIED, context_die);
else else
add_type_attribute (parm_die, type, add_type_attribute (parm_die, type,
TREE_READONLY (node_or_origin), decl_quals (node_or_origin),
TREE_THIS_VOLATILE (node_or_origin),
context_die); context_die);
} }
if (origin == NULL && DECL_ARTIFICIAL (node)) if (origin == NULL && DECL_ARTIFICIAL (node))
...@@ -17605,7 +17622,8 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, ...@@ -17605,7 +17622,8 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p,
case tcc_type: case tcc_type:
/* We were called with some kind of a ..._TYPE node. */ /* We were called with some kind of a ..._TYPE node. */
add_type_attribute (parm_die, node_or_origin, 0, 0, context_die); add_type_attribute (parm_die, node_or_origin, TYPE_UNQUALIFIED,
context_die);
break; break;
default: default:
...@@ -18187,7 +18205,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) ...@@ -18187,7 +18205,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
dw_die_ref die = get_AT_ref (old_die, DW_AT_type); dw_die_ref die = get_AT_ref (old_die, DW_AT_type);
if (die == auto_die || die == decltype_auto_die) if (die == auto_die || die == decltype_auto_die)
add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)), add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)),
0, 0, context_die); TYPE_UNQUALIFIED, context_die);
} }
} }
} }
...@@ -18204,7 +18222,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) ...@@ -18204,7 +18222,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
{ {
add_prototyped_attribute (subr_die, TREE_TYPE (decl)); add_prototyped_attribute (subr_die, TREE_TYPE (decl));
add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)), add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)),
0, 0, context_die); TYPE_UNQUALIFIED, context_die);
} }
add_pure_or_virtual_attribute (subr_die, decl); add_pure_or_virtual_attribute (subr_die, decl);
...@@ -18819,8 +18837,8 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) ...@@ -18819,8 +18837,8 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
} }
var_die = new_die (DW_TAG_variable, com_die, decl); var_die = new_die (DW_TAG_variable, com_die, decl);
add_name_and_src_coords_attributes (var_die, decl); add_name_and_src_coords_attributes (var_die, decl);
add_type_attribute (var_die, TREE_TYPE (decl), TREE_READONLY (decl), add_type_attribute (var_die, TREE_TYPE (decl), decl_quals (decl),
TREE_THIS_VOLATILE (decl), context_die); context_die);
add_AT_flag (var_die, DW_AT_external, 1); add_AT_flag (var_die, DW_AT_external, 1);
if (loc) if (loc)
{ {
...@@ -18913,10 +18931,11 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) ...@@ -18913,10 +18931,11 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
tree type = TREE_TYPE (decl_or_origin); tree type = TREE_TYPE (decl_or_origin);
if (decl_by_reference_p (decl_or_origin)) if (decl_by_reference_p (decl_or_origin))
add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die); add_type_attribute (var_die, TREE_TYPE (type), TYPE_UNQUALIFIED,
context_die);
else else
add_type_attribute (var_die, type, TREE_READONLY (decl_or_origin), add_type_attribute (var_die, type, decl_quals (decl_or_origin),
TREE_THIS_VOLATILE (decl_or_origin), context_die); context_die);
} }
if (origin == NULL && !specialization_p) if (origin == NULL && !specialization_p)
...@@ -18970,7 +18989,7 @@ gen_const_die (tree decl, dw_die_ref context_die) ...@@ -18970,7 +18989,7 @@ gen_const_die (tree decl, dw_die_ref context_die)
const_die = new_die (DW_TAG_constant, context_die, decl); const_die = new_die (DW_TAG_constant, context_die, decl);
add_name_and_src_coords_attributes (const_die, decl); add_name_and_src_coords_attributes (const_die, decl);
add_type_attribute (const_die, type, 1, 0, context_die); add_type_attribute (const_die, type, TYPE_QUAL_CONST, context_die);
if (TREE_PUBLIC (decl)) if (TREE_PUBLIC (decl))
add_AT_flag (const_die, DW_AT_external, 1); add_AT_flag (const_die, DW_AT_external, 1);
if (DECL_ARTIFICIAL (decl)) if (DECL_ARTIFICIAL (decl))
...@@ -19213,8 +19232,7 @@ gen_field_die (tree decl, dw_die_ref context_die) ...@@ -19213,8 +19232,7 @@ gen_field_die (tree decl, dw_die_ref context_die)
decl_die = new_die (DW_TAG_member, context_die, decl); decl_die = new_die (DW_TAG_member, context_die, decl);
add_name_and_src_coords_attributes (decl_die, decl); add_name_and_src_coords_attributes (decl_die, decl);
add_type_attribute (decl_die, member_declared_type (decl), add_type_attribute (decl_die, member_declared_type (decl),
TREE_READONLY (decl), TREE_THIS_VOLATILE (decl), decl_quals (decl), context_die);
context_die);
if (DECL_BIT_FIELD_TYPE (decl)) if (DECL_BIT_FIELD_TYPE (decl))
{ {
...@@ -19248,7 +19266,8 @@ gen_pointer_type_die (tree type, dw_die_ref context_die) ...@@ -19248,7 +19266,8 @@ gen_pointer_type_die (tree type, dw_die_ref context_die)
= new_die (DW_TAG_pointer_type, scope_die_for (type, context_die), type); = new_die (DW_TAG_pointer_type, scope_die_for (type, context_die), type);
equate_type_number_to_die (type, ptr_die); equate_type_number_to_die (type, ptr_die);
add_type_attribute (ptr_die, TREE_TYPE (type), 0, 0, context_die); add_type_attribute (ptr_die, TREE_TYPE (type), TYPE_UNQUALIFIED,
context_die);
add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE); add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE);
} }
...@@ -19268,7 +19287,8 @@ gen_reference_type_die (tree type, dw_die_ref context_die) ...@@ -19268,7 +19287,8 @@ gen_reference_type_die (tree type, dw_die_ref context_die)
ref_die = new_die (DW_TAG_reference_type, scope_die, type); ref_die = new_die (DW_TAG_reference_type, scope_die, type);
equate_type_number_to_die (type, ref_die); equate_type_number_to_die (type, ref_die);
add_type_attribute (ref_die, TREE_TYPE (type), 0, 0, context_die); add_type_attribute (ref_die, TREE_TYPE (type), TYPE_UNQUALIFIED,
context_die);
add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE); add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE);
} }
#endif #endif
...@@ -19285,7 +19305,8 @@ gen_ptr_to_mbr_type_die (tree type, dw_die_ref context_die) ...@@ -19285,7 +19305,8 @@ gen_ptr_to_mbr_type_die (tree type, dw_die_ref context_die)
equate_type_number_to_die (type, ptr_die); equate_type_number_to_die (type, ptr_die);
add_AT_die_ref (ptr_die, DW_AT_containing_type, add_AT_die_ref (ptr_die, DW_AT_containing_type,
lookup_type_die (TYPE_OFFSET_BASETYPE (type))); lookup_type_die (TYPE_OFFSET_BASETYPE (type)));
add_type_attribute (ptr_die, TREE_TYPE (type), 0, 0, context_die); add_type_attribute (ptr_die, TREE_TYPE (type), TYPE_UNQUALIFIED,
context_die);
} }
typedef const char *dchar_p; /* For DEF_VEC_P. */ typedef const char *dchar_p; /* For DEF_VEC_P. */
...@@ -19490,7 +19511,7 @@ gen_inheritance_die (tree binfo, tree access, dw_die_ref context_die) ...@@ -19490,7 +19511,7 @@ gen_inheritance_die (tree binfo, tree access, dw_die_ref context_die)
{ {
dw_die_ref die = new_die (DW_TAG_inheritance, context_die, binfo); dw_die_ref die = new_die (DW_TAG_inheritance, context_die, binfo);
add_type_attribute (die, BINFO_TYPE (binfo), 0, 0, context_die); add_type_attribute (die, BINFO_TYPE (binfo), TYPE_UNQUALIFIED, context_die);
add_data_member_location_attribute (die, binfo); add_data_member_location_attribute (die, binfo);
if (BINFO_VIRTUAL_P (binfo)) if (BINFO_VIRTUAL_P (binfo))
...@@ -19687,7 +19708,7 @@ gen_subroutine_type_die (tree type, dw_die_ref context_die) ...@@ -19687,7 +19708,7 @@ gen_subroutine_type_die (tree type, dw_die_ref context_die)
equate_type_number_to_die (type, subr_die); equate_type_number_to_die (type, subr_die);
add_prototyped_attribute (subr_die, type); add_prototyped_attribute (subr_die, type);
add_type_attribute (subr_die, return_type, 0, 0, context_die); add_type_attribute (subr_die, return_type, TYPE_UNQUALIFIED, context_die);
gen_formal_types_die (type, subr_die); gen_formal_types_die (type, subr_die);
if (get_AT (subr_die, DW_AT_name)) if (get_AT (subr_die, DW_AT_name))
...@@ -19755,8 +19776,7 @@ gen_typedef_die (tree decl, dw_die_ref context_die) ...@@ -19755,8 +19776,7 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
} }
} }
add_type_attribute (type_die, type, TREE_READONLY (decl), add_type_attribute (type_die, type, decl_quals (decl), context_die);
TREE_THIS_VOLATILE (decl), context_die);
if (is_naming_typedef_decl (decl)) if (is_naming_typedef_decl (decl))
/* We want that all subsequent calls to lookup_type_die with /* We want that all subsequent calls to lookup_type_die with
...@@ -20331,8 +20351,8 @@ force_type_die (tree type) ...@@ -20331,8 +20351,8 @@ force_type_die (tree type)
{ {
dw_die_ref context_die = get_context_die (TYPE_CONTEXT (type)); dw_die_ref context_die = get_context_die (TYPE_CONTEXT (type));
type_die = modified_type_die (type, TYPE_READONLY (type), type_die = modified_type_die (type, TYPE_QUALS_NO_ADDR_SPACE (type),
TYPE_VOLATILE (type), context_die); context_die);
gcc_assert (type_die); gcc_assert (type_die);
} }
return type_die; return type_die;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment