+2014-04-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * tree.h (TYPE_IDENTIFIER): Declare.
+ * tree.c (subrange_type_for_debug_p): Use it.
+ * godump.c (go_format_type): Likewise.
+ * dwarf2out.c (is_cxx_auto, modified_type_die,
+ gen_type_die_with_usage, gen_type_die_with_usage): Likewise.
+ * dbxout.c (dbxout_type, dbxout_symbol): Likewise.
+
2014-04-14 Jan Hubicka <hubicka@ucw.cz>
PR lto/60820
+2014-04-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity, components_to_record):
+ Use TYPE_IDENTIFIER.
+ * gcc-interface/utils.c (make_aligning_type, maybe_pad_type,
+ finish_record_type, rest_of_record_type_compilation): Likewise.
+
2014-04-14 Eric Botcazou <ebotcazou@adacore.com>
* snames.ads-tmpl (Name_Ivdep): New pragma-related name.
for (index = ndim - 1; index >= 0; index--)
{
tree gnu_index = TYPE_INDEX_TYPE (gnu_index_types[index]);
- tree gnu_index_name = TYPE_NAME (gnu_index);
-
- if (TREE_CODE (gnu_index_name) == TYPE_DECL)
- gnu_index_name = DECL_NAME (gnu_index_name);
+ tree gnu_index_name = TYPE_IDENTIFIER (gnu_index);
/* Make sure to reference the types themselves, and not just
their names, as the debugger may fall back on them. */
if (debug_info_p)
{
tree gnu_subtype_marker = make_node (RECORD_TYPE);
- tree gnu_unpad_base_name = TYPE_NAME (gnu_unpad_base_type);
+ tree gnu_unpad_base_name
+ = TYPE_IDENTIFIER (gnu_unpad_base_type);
tree gnu_size_unit = TYPE_SIZE_UNIT (gnu_type);
- if (TREE_CODE (gnu_unpad_base_name) == TYPE_DECL)
- gnu_unpad_base_name = DECL_NAME (gnu_unpad_base_name);
-
TYPE_NAME (gnu_subtype_marker)
= create_concat_name (gnat_entity, "XVS");
finish_record_type (gnu_subtype_marker,
false, !gnu_decl, definition, false);
if (TYPE_IS_PADDING_P (gnu_type))
- {
- gnu_entity_name = TYPE_NAME (gnu_type);
- if (TREE_CODE (gnu_entity_name) == TYPE_DECL)
- gnu_entity_name = DECL_NAME (gnu_entity_name);
- }
+ gnu_entity_name = TYPE_IDENTIFIER (gnu_type);
/* Now set the RM size of the type. We cannot do it before padding
because we need to accept arbitrary RM sizes on integral types. */
{
Node_Id gnat_discr = Name (variant_part), variant;
tree gnu_discr = gnat_to_gnu (gnat_discr);
- tree gnu_name = TYPE_NAME (gnu_record_type);
+ tree gnu_name = TYPE_IDENTIFIER (gnu_record_type);
tree gnu_var_name
= concat_name (get_identifier (Get_Name_String (Chars (gnat_discr))),
"XVN");
unsigned int variants_align = 0;
unsigned int i;
- if (TREE_CODE (gnu_name) == TYPE_DECL)
- gnu_name = DECL_NAME (gnu_name);
-
gnu_union_name
= concat_name (gnu_name, IDENTIFIER_POINTER (gnu_var_name));
tree vblock_addr_st = size_binop (PLUS_EXPR, record_addr_st, room_st);
tree voffset_st, pos, field;
- tree name = TYPE_NAME (type);
+ tree name = TYPE_IDENTIFIER (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
name = concat_name (name, "ALIGN");
TYPE_NAME (record_type) = name;
&& DECL_IGNORED_P (TYPE_NAME (type))))
{
tree marker = make_node (RECORD_TYPE);
- tree name = TYPE_NAME (record);
- tree orig_name = TYPE_NAME (type);
-
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
-
- if (TREE_CODE (orig_name) == TYPE_DECL)
- orig_name = DECL_NAME (orig_name);
+ tree name = TYPE_IDENTIFIER (record);
+ tree orig_name = TYPE_IDENTIFIER (type);
TYPE_NAME (marker) = concat_name (name, "XVS");
finish_record_type (marker,
bool debug_info_p)
{
enum tree_code code = TREE_CODE (record_type);
- tree name = TYPE_NAME (record_type);
+ tree name = TYPE_IDENTIFIER (record_type);
tree ada_size = bitsize_zero_node;
tree size = bitsize_zero_node;
bool had_size = TYPE_SIZE (record_type) != 0;
/* Always attach the TYPE_STUB_DECL for a record type. It is required to
generate debug info and have a parallel type. */
- if (name && TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
TYPE_STUB_DECL (record_type) = create_type_stub_decl (name, record_type);
/* Globally initialize the record first. If this is a rep'ed record,
tree new_record_type
= make_node (TREE_CODE (record_type) == QUAL_UNION_TYPE
? UNION_TYPE : TREE_CODE (record_type));
- tree orig_name = TYPE_NAME (record_type), new_name;
+ tree orig_name = TYPE_IDENTIFIER (record_type), new_name;
tree last_pos = bitsize_zero_node;
tree old_field, prev_old_field = NULL_TREE;
- if (TREE_CODE (orig_name) == TYPE_DECL)
- orig_name = DECL_NAME (orig_name);
-
new_name
= concat_name (orig_name, TREE_CODE (record_type) == QUAL_UNION_TYPE
? "XVU" : "XVE");
+2014-04-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * cp-tree.h (TYPE_IDENTIFIER): Remove declaration.
+
2014-04-14 Paolo Carlini <paolo.carlini@oracle.com>
* pt.c (mark_template_parm): Use template_parm_level_and_index.
enum languages { lang_c, lang_cplusplus, lang_java };
/* Macros to make error reporting functions' lives easier. */
-#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
#define TYPE_LINKAGE_IDENTIFIER(NODE) \
(TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
another type's definition; instead, output an xref
and let the definition come when the name is defined. */
stabstr_S ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
- if (TYPE_NAME (type) != 0
- /* The C frontend creates for anonymous variable length
- records/unions TYPE_NAME with DECL_NAME NULL. */
- && (TREE_CODE (TYPE_NAME (type)) != TYPE_DECL
- || DECL_NAME (TYPE_NAME (type))))
- dbxout_type_name (type);
+ if (TYPE_IDENTIFIER (type))
+ {
+ /* Note that the C frontend creates for anonymous variable
+ length records/unions TYPE_NAME with DECL_NAME NULL. */
+ dbxout_type_name (type);
+ }
else
{
stabstr_S ("$$");
DBX format, and it confuses some tools such as objdump. */
&& tree_fits_uhwi_p (TYPE_SIZE (type)))
{
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ tree name = TYPE_IDENTIFIER (type);
dbxout_begin_complex_stabs ();
stabstr_I (name);
This is what represents `struct foo' with no typedef. */
/* In C++, the name of a type is the corresponding typedef.
In C, it is an IDENTIFIER_NODE. */
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ tree name = TYPE_IDENTIFIER (type);
dbxout_begin_complex_stabs ();
stabstr_I (name);
{
if (is_cxx ())
{
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ tree name = TYPE_IDENTIFIER (type);
if (name == get_identifier ("auto")
|| name == get_identifier ("decltype(auto)"))
return true;
/* This probably indicates a bug. */
else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
{
- name = TYPE_NAME (type);
- if (name
- && TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ name = TYPE_IDENTIFIER (type);
add_name_attribute (mod_type_die,
name ? IDENTIFIER_POINTER (name) : "__unknown__");
}
dw_die_ref type_die = lookup_type_die (type);
if (type_die == NULL)
{
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
- type_die = new_die (DW_TAG_unspecified_type, comp_unit_die (), type);
+ tree name = TYPE_IDENTIFIER (type);
+ type_die = new_die (DW_TAG_unspecified_type, comp_unit_die (),
+ type);
add_name_attribute (type_die, IDENTIFIER_POINTER (name));
equate_type_number_to_die (type, type_die);
}
default:
if (is_cxx_auto (type))
{
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ tree name = TYPE_IDENTIFIER (type);
dw_die_ref *die = (name == get_identifier ("auto")
? &auto_die : &decltype_auto_die);
if (!*die)
tree name;
void **slot;
- name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ name = TYPE_IDENTIFIER (type);
slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name),
NO_INSERT);
tree name;
void **slot;
- name = TYPE_NAME (TREE_TYPE (type));
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ name = TYPE_IDENTIFIER (TREE_TYPE (type));
slot = htab_find_slot (container->invalid_hash,
IDENTIFIER_POINTER (name), NO_INSERT);
tree name;
void **slot;
- name = TYPE_NAME (TREE_TYPE (field));
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
+ name = TYPE_IDENTIFIER (TREE_TYPE (field));
slot = htab_find_slot (container->invalid_hash,
IDENTIFIER_POINTER (name),
+2014-04-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * objcp-decl.h (OBJC_TYPE_NAME, OBJC_SET_TYPE_NAME): Use
+ TYPE_IDENTIFIER.
+
2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
Update copyright years
objcp_end_compound_stmt (stmt, flags)
#undef OBJC_TYPE_NAME
-#define OBJC_TYPE_NAME(type) \
- (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL \
- ? DECL_NAME (TYPE_NAME (type)) \
- : TYPE_NAME (type))
+#define OBJC_TYPE_NAME(type) (TYPE_IDENTIFIER (type))
#undef OBJC_SET_TYPE_NAME
-#define OBJC_SET_TYPE_NAME(type, name) \
- if(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) \
- DECL_NAME (TYPE_NAME (type)) = name; \
- else \
- TYPE_NAME (type) = name;
+#define OBJC_SET_TYPE_NAME(type, name) (TYPE_IDENTIFIER (type) = (name))
#undef TYPE_OBJC_INFO
#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info
|| TREE_CODE (base_type) == BOOLEAN_TYPE)
&& int_size_in_bytes (type) == int_size_in_bytes (base_type)
&& tree_int_cst_equal (low, TYPE_MIN_VALUE (base_type))
- && tree_int_cst_equal (high, TYPE_MAX_VALUE (base_type)))
- {
- tree type_name = TYPE_NAME (type);
- tree base_type_name = TYPE_NAME (base_type);
-
- if (type_name && TREE_CODE (type_name) == TYPE_DECL)
- type_name = DECL_NAME (type_name);
-
- if (base_type_name && TREE_CODE (base_type_name) == TYPE_DECL)
- base_type_name = DECL_NAME (base_type_name);
-
- if (type_name == base_type_name)
- return false;
- }
+ && tree_int_cst_equal (high, TYPE_MAX_VALUE (base_type))
+ && TYPE_IDENTIFIER (type) == TYPE_IDENTIFIER (base_type))
+ return false;
if (lowval)
*lowval = low;
It is an IDENTIFIER_NODE. */
#define DECL_NAME(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.name)
+/* The IDENTIFIER_NODE associated with the TYPE_NAME field. */
+#define TYPE_IDENTIFIER(NODE) \
+ (TYPE_NAME (NODE) && DECL_P (TYPE_NAME (NODE)) \
+ ? DECL_NAME (TYPE_NAME (NODE)) : TYPE_NAME (NODE))
+
/* Every ..._DECL node gets a unique number. */
#define DECL_UID(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.uid)