cp-tree.h (DECL_FIELD_IS_BASE): New.

* cp-tree.h (DECL_FIELD_IS_BASE): New.
        * class.c (build_base_field): Set it.
        (build_simple_base_path): Use it.
        (fixed_type_or_null): Don't consider base fields definitive.

From-SVN: r86630
This commit is contained in:
Richard Henderson 2004-08-26 11:07:57 -07:00 committed by Richard Henderson
parent 2e6c96419d
commit 642124c635
3 changed files with 20 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2004-08-26 Richard Henderson <rth@redhat.com>
* cp-tree.h (DECL_FIELD_IS_BASE): New.
* class.c (build_base_field): Set it.
(build_simple_base_path): Use it.
(fixed_type_or_null): Don't consider base fields definitive.
2004-08-25 Roger Sayle <roger@eyesopen.com> 2004-08-25 Roger Sayle <roger@eyesopen.com>
PR middle-end/16693 PR middle-end/16693

View File

@ -438,9 +438,8 @@ build_simple_base_path (tree expr, tree binfo)
field; field = TREE_CHAIN (field)) field; field = TREE_CHAIN (field))
/* Is this the base field created by build_base_field? */ /* Is this the base field created by build_base_field? */
if (TREE_CODE (field) == FIELD_DECL if (TREE_CODE (field) == FIELD_DECL
&& TREE_TYPE (field) == type && DECL_FIELD_IS_BASE (field)
&& DECL_ARTIFICIAL (field) && TREE_TYPE (field) == type)
&& DECL_IGNORED_P (field))
return build_class_member_access_expr (expr, field, return build_class_member_access_expr (expr, field,
NULL_TREE, false); NULL_TREE, false);
@ -3642,6 +3641,7 @@ build_base_field (record_layout_info rli, tree binfo,
DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype); DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype);
DECL_IGNORED_P (decl) = 1; DECL_IGNORED_P (decl) = 1;
DECL_FIELD_IS_BASE (decl) = 1;
/* Try to place the field. It may take more than one try if we /* Try to place the field. It may take more than one try if we
have a hard time placing the field without putting two have a hard time placing the field without putting two
@ -5300,6 +5300,10 @@ fixed_type_or_null (tree instance, int* nonnull, int* cdtorp)
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp); return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
case COMPONENT_REF: case COMPONENT_REF:
/* If this component is really a base class reference, then the field
itself isn't definitive. */
if (DECL_FIELD_IS_BASE (TREE_OPERAND (instance, 1)))
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull, cdtorp); return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull, cdtorp);
case VAR_DECL: case VAR_DECL:

View File

@ -100,6 +100,7 @@ struct diagnostic_context;
DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL) DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL)
5: DECL_INTERFACE_KNOWN. 5: DECL_INTERFACE_KNOWN.
6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
DECL_FIELD_IS_BASE (in FIELD_DECL)
7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
DECL_THUNK_P (in a member FUNCTION_DECL) DECL_THUNK_P (in a member FUNCTION_DECL)
@ -2550,6 +2551,11 @@ struct lang_decl GTY(())
#define DECL_THIS_STATIC(NODE) \ #define DECL_THIS_STATIC(NODE) \
DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE)) DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
/* Nonzero for FIELD_DECL node means that this field is a base class
of the parent object, as opposed to a member field. */
#define DECL_FIELD_IS_BASE(NODE) \
DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
/* Nonzero if TYPE is an anonymous union or struct type. We have to use a /* Nonzero if TYPE is an anonymous union or struct type. We have to use a
flag for this because "A union for which objects or pointers are flag for this because "A union for which objects or pointers are
declared is not an anonymous union" [class.union]. */ declared is not an anonymous union" [class.union]. */