static bool
has_static_fields (const_tree type)
{
- tree tmp;
-
if (!type || !RECORD_OR_UNION_TYPE_P (type))
return false;
- for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp))
- if (DECL_NAME (tmp) && TREE_STATIC (tmp))
+ for (tree fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld))
+ if (TREE_CODE (fld) == FIELD_DECL && DECL_NAME (fld) && TREE_STATIC (fld))
return true;
return false;
{
if (is_tagged_type (TREE_TYPE (node)))
{
- tree tmp = TYPE_FIELDS (TREE_TYPE (node));
int first = 1;
/* Look for ancestors. */
- for (; tmp; tmp = TREE_CHAIN (tmp))
+ for (tree fld = TYPE_FIELDS (TREE_TYPE (node));
+ fld;
+ fld = TREE_CHAIN (fld))
{
- if (!DECL_NAME (tmp) && is_tagged_type (TREE_TYPE (tmp)))
+ if (!DECL_NAME (fld) && is_tagged_type (TREE_TYPE (fld)))
{
if (first)
{
else
pp_string (buffer, " and ");
- dump_ada_decl_name
- (buffer, TYPE_NAME (TREE_TYPE (tmp)), false);
+ dump_ada_decl_name (buffer, TYPE_NAME (TREE_TYPE (fld)),
+ false);
}
}
dump_nested_type (buffer, field, t, parent, spc);
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- if (!TYPE_NAME (TREE_TYPE (field)))
+ if (TREE_CODE (field) == FIELD_DECL && !TYPE_NAME (TREE_TYPE (field)))
dump_nested_type (buffer, field, t, parent, spc);
TREE_VISITED (t) = 1;
if (is_constructor && RECORD_OR_UNION_TYPE_P (type))
for (tree fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
- if (cpp_check (fld, IS_ABSTRACT))
+ if (TREE_CODE (TREE_TYPE (fld)) == METHOD_TYPE
+ && cpp_check (fld, IS_ABSTRACT))
{
is_abstract_class = true;
break;
if (cpp_check
&& RECORD_OR_UNION_TYPE_P (TREE_TYPE (t)))
{
- is_interface = -1;
+ bool has_fields = false;
/* Check that there are no fields other than the virtual table. */
for (tree fld = TYPE_FIELDS (TREE_TYPE (t));
- fld; fld = TREE_CHAIN (fld))
+ fld;
+ fld = TREE_CHAIN (fld))
{
if (TREE_CODE (fld) == FIELD_DECL)
{
- if (is_interface < 0 && DECL_VIRTUAL_P (fld))
+ if (!has_fields && DECL_VIRTUAL_P (fld))
is_interface = 1;
else
is_interface = 0;
+ has_fields = true;
}
else if (TREE_CODE (TREE_TYPE (fld)) == METHOD_TYPE
&& !DECL_ARTIFICIAL (fld))
field_num++;
}
}
- else if (TREE_CODE (tmp) != TYPE_DECL && !TREE_STATIC (tmp))
+ else if (TREE_CODE (tmp) == FIELD_DECL && !TREE_STATIC (tmp))
{
/* Skip internal virtual table field. */
- if (strncmp (IDENTIFIER_POINTER (DECL_NAME (tmp)), "_vptr", 5))
+ if (!DECL_VIRTUAL_P (tmp))
{
if (is_union)
{
/* Print the static fields of the structure, if any. */
for (tmp = TYPE_FIELDS (node); tmp; tmp = TREE_CHAIN (tmp))
{
- if (DECL_NAME (tmp) && TREE_STATIC (tmp))
+ if (TREE_CODE (tmp) == FIELD_DECL
+ && DECL_NAME (tmp)
+ && TREE_STATIC (tmp))
{
if (need_semicolon)
{