This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] Rename IS_AGGR_TYPE & co
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Fri, 14 Mar 2008 00:38:40 +0100
- Subject: [C++ Patch] Rename IS_AGGR_TYPE & co
Hi all, hi Mark,
this is the patch which I finally regtested on x86_64-linux: supposedly,
it implements rather strictly all your suggestions (many thanks again
for those).
I would ask you to specifically double check the make_class_type
(TREE_CODE (t)) call in begin_class_definition (semantics.c), that is,
that TREE_CODE can only boils down to either RECORD_TYPE or UNION_TYPE
in that case.
Paolo.
///////////////////
2008-03-14 Paolo Carlini <pcarlini@suse.de>
* cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P.
(SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P.
(IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P.
(PROMOTES_TO_AGGR_TYPE): Remove.
(CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust.
* typeck.c (unary_complex_lvalue, build_modify_expr,
convert_for_initialization): Adjust.
* init.c (is_aggr_type): Remove.
(is_class_type): Add.
(build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init,
build_delete): Adjust.
* lex.c (make_aggr_type): Remove.
(make_class_type): Add.
(cxx_make_type): Adjust.
* class.c (finish_struct_1, fixed_type_or_null, is_empty_class):
Adjust.
* decl.c (build_typename_type, make_typename_type,
make_unbound_class_template, cxx_init_decl_processing,
check_tag_decl, groktypename, start_decl_1, layout_var_decl,
check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms,
grok_op_properties, xref_tag, check_function_type): Adjust.
* call.c (check_dtor_name, standard_conversion, implicit_conversion,
add_builtin_candidate, add_builtin_candidates,
build_user_type_conversion_1, convert_like_real, build_cxx_call,
is_subseq, compare_ics): Adjust.
* method.c (use_thunk): Adjust.
* rtti.c (build_dynamic_cast_1, create_pseudo_type_info,
create_tinfo_types): Adjust.
* cvt.c (cp_convert_to_pointer, convert_to_pointer_force,
build_up_reference, convert_to_reference, convert_from_reference,
ocp_convert, build_expr_type_conversion): Adjust.
* tree.c (bind_template_template_parm, error_type): Adjust.
* dump.c (cp_dump_tree): Adjust.
* search.c (lookup_member): Adjust.
* friend.c (make_friend_class, do_friend): Adjust.
* typeck2.c (store_init_value, process_init_constructor_array,
process_init_constructor_record, build_x_arrow, build_m_component_ref,
build_functional_cast): Adjust.
* pt.c (finish_member_template_decl, process_template_parm,
lookup_template_class, tsubst_function_type, tsubst,
tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc):
Adjust.
* semantics.c (begin_class_definition, finish_base_specifier,
finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type):
Adjust.
* name-lookup.c (constructor_name_p, push_overloaded_decl,
do_class_using_decl, lookup_qualified_name,
maybe_process_template_type_declaration): Adjust.
* decl2.c (grok_array_decl, check_member_template,
constrain_class_visibility): Adjust.
* parser.c (cp_parser_class_name): Adjust.
Index: typeck.c
===================================================================
*** typeck.c (revision 133188)
--- typeck.c (working copy)
***************
*** 1,6 ****
/* Build expressions with type checking for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
--- 1,6 ----
/* Build expressions with type checking for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
*************** unary_complex_lvalue (enum tree_code cod
*** 4630,4636 ****
if (TREE_CODE (targ) == SAVE_EXPR)
targ = TREE_OPERAND (targ, 0);
! if (TREE_CODE (targ) == CALL_EXPR && IS_AGGR_TYPE (TREE_TYPE (targ)))
{
if (TREE_CODE (arg) == SAVE_EXPR)
targ = arg;
--- 4630,4636 ----
if (TREE_CODE (targ) == SAVE_EXPR)
targ = TREE_OPERAND (targ, 0);
! if (TREE_CODE (targ) == CALL_EXPR && MAYBE_CLASS_TYPE_P (TREE_TYPE (targ)))
{
if (TREE_CODE (arg) == SAVE_EXPR)
targ = arg;
*************** build_modify_expr (tree lhs, enum tree_c
*** 5751,5757 ****
TREE_SIDE_EFFECTS (result) = 1;
return result;
}
! else if (! IS_AGGR_TYPE (lhstype))
/* Do the default thing. */;
else
{
--- 5751,5757 ----
TREE_SIDE_EFFECTS (result) = 1;
return result;
}
! else if (! MAYBE_CLASS_TYPE_P (lhstype))
/* Do the default thing. */;
else
{
*************** build_modify_expr (tree lhs, enum tree_c
*** 5772,5778 ****
if (modifycode == NOP_EXPR)
{
/* `operator=' is not an inheritable operator. */
! if (! IS_AGGR_TYPE (lhstype))
/* Do the default thing. */;
else
{
--- 5772,5778 ----
if (modifycode == NOP_EXPR)
{
/* `operator=' is not an inheritable operator. */
! if (! MAYBE_CLASS_TYPE_P (lhstype))
/* Do the default thing. */;
else
{
*************** build_modify_expr (tree lhs, enum tree_c
*** 5790,5797 ****
/* A binary op has been requested. Combine the old LHS
value with the RHS producing the value we should actually
store into the LHS. */
- gcc_assert (!PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE));
lhs = stabilize_reference (lhs);
newrhs = cp_build_binary_op (modifycode, lhs, rhs);
if (newrhs == error_mark_node)
--- 5790,5799 ----
/* A binary op has been requested. Combine the old LHS
value with the RHS producing the value we should actually
store into the LHS. */
+ gcc_assert (!((TREE_CODE (lhstype) == REFERENCE_TYPE
+ && MAYBE_CLASS_TYPE_P (TREE_TYPE (lhstype)))
+ || MAYBE_CLASS_TYPE_P (lhstype)));
lhs = stabilize_reference (lhs);
newrhs = cp_build_binary_op (modifycode, lhs, rhs);
if (newrhs == error_mark_node)
*************** convert_for_initialization (tree exp, tr
*** 6512,6518 ****
type = complete_type (type);
! if (IS_AGGR_TYPE (type))
return ocp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
return convert_for_assignment (type, rhs, errtype, fndecl, parmnum);
--- 6514,6520 ----
type = complete_type (type);
! if (MAYBE_CLASS_TYPE_P (type))
return ocp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
return convert_for_assignment (type, rhs, errtype, fndecl, parmnum);
Index: init.c
===================================================================
*** init.c (revision 133188)
--- init.c (working copy)
*************** expand_aggr_init_1 (tree binfo, tree tru
*** 1420,1438 ****
expand_default_init (binfo, true_exp, exp, init, flags);
}
! /* Report an error if TYPE is not a user-defined, aggregate type. If
OR_ELSE is nonzero, give an error message. */
int
! is_aggr_type (tree type, int or_else)
{
if (type == error_mark_node)
return 0;
! if (! IS_AGGR_TYPE (type))
{
if (or_else)
! error ("%qT is not an aggregate type", type);
return 0;
}
return 1;
--- 1420,1438 ----
expand_default_init (binfo, true_exp, exp, init, flags);
}
! /* Report an error if TYPE is not a user-defined, class type. If
OR_ELSE is nonzero, give an error message. */
int
! is_class_type (tree type, int or_else)
{
if (type == error_mark_node)
return 0;
! if (! CLASS_TYPE_P (type))
{
if (or_else)
! error ("%qT is not a class type", type);
return 0;
}
return 1;
*************** build_offset_ref (tree type, tree member
*** 1476,1482 ****
/*template_p=*/false);
gcc_assert (TYPE_P (type));
! if (! is_aggr_type (type, 1))
return error_mark_node;
gcc_assert (DECL_P (member) || BASELINK_P (member));
--- 1476,1482 ----
/*template_p=*/false);
gcc_assert (TYPE_P (type));
! if (! is_class_type (type, 1))
return error_mark_node;
gcc_assert (DECL_P (member) || BASELINK_P (member));
*************** build_new_1 (tree placement, tree type,
*** 1921,1927 ****
(alloc_fn,
build_tree_list (NULL_TREE, class_addr)));
}
! else if (TYPE_FOR_JAVA (elt_type) && IS_AGGR_TYPE (elt_type))
{
error ("Java class %q#T object allocated using placement new", elt_type);
return error_mark_node;
--- 1921,1927 ----
(alloc_fn,
build_tree_list (NULL_TREE, class_addr)));
}
! else if (TYPE_FOR_JAVA (elt_type) && MAYBE_CLASS_TYPE_P (elt_type))
{
error ("Java class %q#T object allocated using placement new", elt_type);
return error_mark_node;
*************** build_vec_delete_1 (tree base, tree maxi
*** 2456,2462 ****
/* We should only have 1-D arrays here. */
gcc_assert (TREE_CODE (type) != ARRAY_TYPE);
! if (! IS_AGGR_TYPE (type) || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
goto no_destructor;
/* The below is short by the cookie size. */
--- 2456,2462 ----
/* We should only have 1-D arrays here. */
gcc_assert (TREE_CODE (type) != ARRAY_TYPE);
! if (! MAYBE_CLASS_TYPE_P (type) || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
goto no_destructor;
/* The below is short by the cookie size. */
*************** build_vec_init (tree base, tree maxindex
*** 2736,2742 ****
num_initialized_elts++;
current_stmt_tree ()->stmts_are_full_exprs_p = 1;
! if (IS_AGGR_TYPE (type) || TREE_CODE (type) == ARRAY_TYPE)
finish_expr_stmt (build_aggr_init (baseref, elt, 0));
else
finish_expr_stmt (build_modify_expr (baseref, NOP_EXPR,
--- 2736,2742 ----
num_initialized_elts++;
current_stmt_tree ()->stmts_are_full_exprs_p = 1;
! if (MAYBE_CLASS_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)
finish_expr_stmt (build_aggr_init (baseref, elt, 0));
else
finish_expr_stmt (build_modify_expr (baseref, NOP_EXPR,
*************** build_delete (tree type, tree addr, spec
*** 2967,2973 ****
complete_p = false;
}
}
! if (VOID_TYPE_P (type) || !complete_p || !IS_AGGR_TYPE (type))
/* Call the builtin operator delete. */
return build_builtin_delete_call (addr);
if (TREE_SIDE_EFFECTS (addr))
--- 2967,2973 ----
complete_p = false;
}
}
! if (VOID_TYPE_P (type) || !complete_p || !MAYBE_CLASS_TYPE_P (type))
/* Call the builtin operator delete. */
return build_builtin_delete_call (addr);
if (TREE_SIDE_EFFECTS (addr))
*************** build_delete (tree type, tree addr, spec
*** 3000,3006 ****
addr = convert_force (build_pointer_type (type), addr, 0);
}
! gcc_assert (IS_AGGR_TYPE (type));
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
{
--- 3000,3006 ----
addr = convert_force (build_pointer_type (type), addr, 0);
}
! gcc_assert (MAYBE_CLASS_TYPE_P (type));
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
{
Index: class.c
===================================================================
*** class.c (revision 133188)
--- class.c (working copy)
***************
*** 1,6 ****
/* Functions related to building classes and their related objects.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
--- 1,6 ----
/* Functions related to building classes and their related objects.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
*************** layout_class_type (tree t, tree *virtual
*** 4926,4932 ****
remove_zero_width_bit_fields (t);
/* Create the version of T used for virtual bases. We do not use
! make_aggr_type for this version; this is an artificial type. For
a POD type, we just reuse T. */
if (CLASSTYPE_NON_POD_P (t) || CLASSTYPE_EMPTY_P (t))
{
--- 4926,4932 ----
remove_zero_width_bit_fields (t);
/* Create the version of T used for virtual bases. We do not use
! make_class_type for this version; this is an artificial type. For
a POD type, we just reuse T. */
if (CLASSTYPE_NON_POD_P (t) || CLASSTYPE_EMPTY_P (t))
{
*************** finish_struct_1 (tree t)
*** 5086,5092 ****
if (COMPLETE_TYPE_P (t))
{
! gcc_assert (IS_AGGR_TYPE (t));
error ("redefinition of %q#T", t);
popclass ();
return;
--- 5086,5092 ----
if (COMPLETE_TYPE_P (t))
{
! gcc_assert (MAYBE_CLASS_TYPE_P (t));
error ("redefinition of %q#T", t);
popclass ();
return;
*************** fixed_type_or_null (tree instance, int *
*** 5432,5438 ****
case VAR_DECL:
case FIELD_DECL:
if (TREE_CODE (TREE_TYPE (instance)) == ARRAY_TYPE
! && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (instance))))
{
if (nonnull)
*nonnull = 1;
--- 5432,5438 ----
case VAR_DECL:
case FIELD_DECL:
if (TREE_CODE (TREE_TYPE (instance)) == ARRAY_TYPE
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (instance))))
{
if (nonnull)
*nonnull = 1;
*************** fixed_type_or_null (tree instance, int *
*** 5442,5448 ****
case TARGET_EXPR:
case PARM_DECL:
case RESULT_DECL:
! if (IS_AGGR_TYPE (TREE_TYPE (instance)))
{
if (nonnull)
*nonnull = 1;
--- 5442,5448 ----
case TARGET_EXPR:
case PARM_DECL:
case RESULT_DECL:
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (instance)))
{
if (nonnull)
*nonnull = 1;
*************** is_empty_class (tree type)
*** 6343,6349 ****
if (type == error_mark_node)
return 0;
! if (! IS_AGGR_TYPE (type))
return 0;
/* In G++ 3.2, whether or not a class was empty was determined by
--- 6343,6349 ----
if (type == error_mark_node)
return 0;
! if (! MAYBE_CLASS_TYPE_P (type))
return 0;
/* In G++ 3.2, whether or not a class was empty was determined by
Index: decl.c
===================================================================
*** decl.c (revision 133188)
--- decl.c (working copy)
*************** build_typename_type (tree context, tree
*** 2891,2897 ****
else
{
/* Build the TYPENAME_TYPE. */
! t = make_aggr_type (TYPENAME_TYPE);
TYPE_CONTEXT (t) = ti.scope;
TYPENAME_TYPE_FULLNAME (t) = ti.template_id;
TYPENAME_IS_ENUM_P (t) = ti.enum_p;
--- 2891,2897 ----
else
{
/* Build the TYPENAME_TYPE. */
! t = cxx_make_type (TYPENAME_TYPE);
TYPE_CONTEXT (t) = ti.scope;
TYPENAME_TYPE_FULLNAME (t) = ti.template_id;
TYPENAME_IS_ENUM_P (t) = ti.enum_p;
*************** make_typename_type (tree context, tree n
*** 2979,2985 ****
if (dependent_type_p (context))
return build_typename_type (context, name, fullname, tag_type);
! if (!IS_AGGR_TYPE (context))
{
if (complain & tf_error)
error ("%q#T is not a class", context);
--- 2979,2985 ----
if (dependent_type_p (context))
return build_typename_type (context, name, fullname, tag_type);
! if (!MAYBE_CLASS_TYPE_P (context))
{
if (complain & tf_error)
error ("%q#T is not a class", context);
*************** make_unbound_class_template (tree contex
*** 3056,3062 ****
{
tree tmpl = NULL_TREE;
! if (IS_AGGR_TYPE (context))
tmpl = lookup_field (context, name, 0, false);
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
--- 3056,3062 ----
{
tree tmpl = NULL_TREE;
! if (MAYBE_CLASS_TYPE_P (context))
tmpl = lookup_field (context, name, 0, false);
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
*************** make_unbound_class_template (tree contex
*** 3084,3090 ****
}
/* Build the UNBOUND_CLASS_TEMPLATE. */
! t = make_aggr_type (UNBOUND_CLASS_TEMPLATE);
TYPE_CONTEXT (t) = FROB_CONTEXT (context);
TREE_TYPE (t) = NULL_TREE;
SET_TYPE_STRUCTURAL_EQUALITY (t);
--- 3084,3090 ----
}
/* Build the UNBOUND_CLASS_TEMPLATE. */
! t = cxx_make_type (UNBOUND_CLASS_TEMPLATE);
TYPE_CONTEXT (t) = FROB_CONTEXT (context);
TREE_TYPE (t) = NULL_TREE;
SET_TYPE_STRUCTURAL_EQUALITY (t);
*************** cxx_init_decl_processing (void)
*** 3382,3388 ****
push_namespace (std_identifier);
bad_alloc_id = get_identifier ("bad_alloc");
! bad_alloc_type_node = make_aggr_type (RECORD_TYPE);
TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
bad_alloc_decl
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
--- 3382,3388 ----
push_namespace (std_identifier);
bad_alloc_id = get_identifier ("bad_alloc");
! bad_alloc_type_node = make_class_type (RECORD_TYPE);
TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
bad_alloc_decl
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
*************** check_tag_decl (cp_decl_specifier_seq *d
*** 3773,3779 ****
if (declspecs->type
&& TYPE_P (declspecs->type)
&& ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
! && IS_AGGR_TYPE (declspecs->type))
|| TREE_CODE (declspecs->type) == ENUMERAL_TYPE))
declared_type = declspecs->type;
else if (declspecs->type == error_mark_node)
--- 3773,3779 ----
if (declspecs->type
&& TYPE_P (declspecs->type)
&& ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
! && MAYBE_CLASS_TYPE_P (declspecs->type))
|| TREE_CODE (declspecs->type) == ENUMERAL_TYPE))
declared_type = declspecs->type;
else if (declspecs->type == error_mark_node)
*************** check_tag_decl (cp_decl_specifier_seq *d
*** 3781,3787 ****
if (declared_type == NULL_TREE && ! saw_friend && !error_p)
pedwarn ("declaration does not declare anything");
/* Check for an anonymous union. */
! else if (declared_type && IS_AGGR_TYPE_CODE (TREE_CODE (declared_type))
&& TYPE_ANONYMOUS_P (declared_type))
{
/* 7/3 In a simple-declaration, the optional init-declarator-list
--- 3781,3787 ----
if (declared_type == NULL_TREE && ! saw_friend && !error_p)
pedwarn ("declaration does not declare anything");
/* Check for an anonymous union. */
! else if (declared_type && RECORD_OR_UNION_CODE_P (TREE_CODE (declared_type))
&& TYPE_ANONYMOUS_P (declared_type))
{
/* 7/3 In a simple-declaration, the optional init-declarator-list
*************** groktypename (cp_decl_specifier_seq *typ
*** 3910,3916 ****
if (CLASS_TYPE_P (type))
warning (OPT_Wattributes, "ignoring attributes applied to class type %qT "
"outside of definition", type);
! else if (IS_AGGR_TYPE (type))
/* A template type parameter or other dependent type. */
warning (OPT_Wattributes, "ignoring attributes applied to dependent "
"type %qT without an associated declaration", type);
--- 3910,3916 ----
if (CLASS_TYPE_P (type))
warning (OPT_Wattributes, "ignoring attributes applied to class type %qT "
"outside of definition", type);
! else if (MAYBE_CLASS_TYPE_P (type))
/* A template type parameter or other dependent type. */
warning (OPT_Wattributes, "ignoring attributes applied to dependent "
"type %qT without an associated declaration", type);
*************** start_decl_1 (tree decl, bool initialize
*** 4174,4180 ****
type = TREE_TYPE (decl);
complete_p = COMPLETE_TYPE_P (type);
! aggregate_definition_p = IS_AGGR_TYPE (type) && !DECL_EXTERNAL (decl);
/* If an explicit initializer is present, or if this is a definition
of an aggregate, then we need a complete type at this point.
--- 4174,4180 ----
type = TREE_TYPE (decl);
complete_p = COMPLETE_TYPE_P (type);
! aggregate_definition_p = MAYBE_CLASS_TYPE_P (type) && !DECL_EXTERNAL (decl);
/* If an explicit initializer is present, or if this is a definition
of an aggregate, then we need a complete type at this point.
*************** layout_var_decl (tree decl)
*** 4427,4433 ****
/* Keep this code around in case we later want to control debug info
based on whether a type is "used". (jason 1999-11-11) */
! else if (!DECL_EXTERNAL (decl) && IS_AGGR_TYPE (ttype))
/* Let debugger know it should output info for this type. */
note_debug_info_needed (ttype);
--- 4427,4433 ----
/* Keep this code around in case we later want to control debug info
based on whether a type is "used". (jason 1999-11-11) */
! else if (!DECL_EXTERNAL (decl) && MAYBE_CLASS_TYPE_P (ttype))
/* Let debugger know it should output info for this type. */
note_debug_info_needed (ttype);
*************** check_initializer (tree decl, tree init,
*** 5054,5060 ****
;
else if (TYPE_P (type) && TYPE_NEEDS_CONSTRUCTING (type))
goto initialize_aggr;
! else if (IS_AGGR_TYPE (type))
{
tree core_type = strip_array_types (type);
--- 5054,5060 ----
;
else if (TYPE_P (type) && TYPE_NEEDS_CONSTRUCTING (type))
goto initialize_aggr;
! else if (MAYBE_CLASS_TYPE_P (type))
{
tree core_type = strip_array_types (type);
*************** cp_finish_decl (tree decl, tree init, bo
*** 5450,5456 ****
if (TREE_CODE (decl) == TYPE_DECL)
{
if (type != error_mark_node
! && IS_AGGR_TYPE (type) && DECL_NAME (decl))
{
if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type)
warning (0, "shadowing previous type declaration of %q#D", decl);
--- 5450,5456 ----
if (TREE_CODE (decl) == TYPE_DECL)
{
if (type != error_mark_node
! && MAYBE_CLASS_TYPE_P (type) && DECL_NAME (decl))
{
if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type)
warning (0, "shadowing previous type declaration of %q#D", decl);
*************** cp_finish_decl (tree decl, tree init, bo
*** 5504,5510 ****
is *not* defined. */
&& (!DECL_EXTERNAL (decl) || init))
{
! if (TYPE_FOR_JAVA (type) && IS_AGGR_TYPE (type))
{
tree jclass
= IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass"));
--- 5504,5510 ----
is *not* defined. */
&& (!DECL_EXTERNAL (decl) || init))
{
! if (TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type))
{
tree jclass
= IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass"));
*************** cp_finish_decl (tree decl, tree init, bo
*** 5589,5595 ****
layout_type (type);
}
else if (TREE_CODE (decl) == FIELD_DECL
! && TYPE_FOR_JAVA (type) && IS_AGGR_TYPE (type))
error ("non-static data member %qD has Java class type", decl);
/* Add this declaration to the statement-tree. This needs to happen
--- 5589,5595 ----
layout_type (type);
}
else if (TREE_CODE (decl) == FIELD_DECL
! && TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type))
error ("non-static data member %qD has Java class type", decl);
/* Add this declaration to the statement-tree. This needs to happen
*************** build_ptrmemfunc_type (tree type)
*** 6854,6866 ****
unqualified_variant
= build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
! t = make_aggr_type (RECORD_TYPE);
xref_basetypes (t, NULL_TREE);
/* Let the front end know this is a pointer to member function... */
TYPE_PTRMEMFUNC_FLAG (t) = 1;
! /* ... and not really an aggregate. */
! SET_IS_AGGR_TYPE (t, 0);
field = build_decl (FIELD_DECL, pfn_identifier, type);
fields = field;
--- 6854,6866 ----
unqualified_variant
= build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
! t = make_class_type (RECORD_TYPE);
xref_basetypes (t, NULL_TREE);
/* Let the front end know this is a pointer to member function... */
TYPE_PTRMEMFUNC_FLAG (t) = 1;
! /* ... and not really a class type. */
! SET_CLASS_TYPE_P (t, 0);
field = build_decl (FIELD_DECL, pfn_identifier, type);
fields = field;
*************** grokparms (cp_parameter_declarator *firs
*** 9383,9389 ****
if (type != error_mark_node
&& TYPE_FOR_JAVA (type)
! && IS_AGGR_TYPE (type))
{
error ("parameter %qD has Java class type", decl);
type = error_mark_node;
--- 9383,9389 ----
if (type != error_mark_node
&& TYPE_FOR_JAVA (type)
! && MAYBE_CLASS_TYPE_P (type))
{
error ("parameter %qD has Java class type", decl);
type = error_mark_node;
*************** grok_op_properties (tree decl, bool comp
*** 9831,9840 ****
if (arg == error_mark_node)
return false;
! /* IS_AGGR_TYPE, rather than CLASS_TYPE_P, is used
because these checks are performed even on
template functions. */
! if (IS_AGGR_TYPE (arg) || TREE_CODE (arg) == ENUMERAL_TYPE)
break;
}
--- 9831,9841 ----
if (arg == error_mark_node)
return false;
! /* MAYBE_CLASS_TYPE_P, rather than CLASS_TYPE_P, is used
because these checks are performed even on
template functions. */
! if (MAYBE_CLASS_TYPE_P (arg)
! || TREE_CODE (arg) == ENUMERAL_TYPE)
break;
}
*************** grok_op_properties (tree decl, bool comp
*** 9875,9881 ****
if (t == class_type)
what = "the same type";
/* Don't force t to be complete here. */
! else if (IS_AGGR_TYPE (t)
&& COMPLETE_TYPE_P (t)
&& DERIVED_FROM_P (t, class_type))
what = "a base class";
--- 9876,9882 ----
if (t == class_type)
what = "the same type";
/* Don't force t to be complete here. */
! else if (MAYBE_CLASS_TYPE_P (t)
&& COMPLETE_TYPE_P (t)
&& DERIVED_FROM_P (t, class_type))
what = "a base class";
*************** xref_tag (enum tag_types tag_code, tree
*** 10349,10362 ****
}
else
{
! t = make_aggr_type (code);
TYPE_CONTEXT (t) = context;
t = pushtag (name, t, scope);
}
}
else
{
! if (template_header_p && IS_AGGR_TYPE (t))
{
if (!redeclare_class_template (t, current_template_parms))
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
--- 10350,10363 ----
}
else
{
! t = make_class_type (code);
TYPE_CONTEXT (t) = context;
t = pushtag (name, t, scope);
}
}
else
{
! if (template_header_p && MAYBE_CLASS_TYPE_P (t))
{
if (!redeclare_class_template (t, current_template_parms))
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
*************** check_function_type (tree decl, tree cur
*** 10983,10989 ****
if (dependent_type_p (return_type))
return;
if (!COMPLETE_OR_VOID_TYPE_P (return_type)
! || (TYPE_FOR_JAVA (return_type) && IS_AGGR_TYPE (return_type)))
{
tree args = TYPE_ARG_TYPES (fntype);
--- 10984,10990 ----
if (dependent_type_p (return_type))
return;
if (!COMPLETE_OR_VOID_TYPE_P (return_type)
! || (TYPE_FOR_JAVA (return_type) && MAYBE_CLASS_TYPE_P (return_type)))
{
tree args = TYPE_ARG_TYPES (fntype);
Index: call.c
===================================================================
*** call.c (revision 133188)
--- call.c (working copy)
*************** check_dtor_name (tree basetype, tree nam
*** 214,220 ****
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
{
! if ((IS_AGGR_TYPE (basetype) && name == constructor_name (basetype))
|| (TREE_CODE (basetype) == ENUMERAL_TYPE
&& name == TYPE_IDENTIFIER (basetype)))
return true;
--- 214,221 ----
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
{
! if ((MAYBE_CLASS_TYPE_P (basetype)
! && name == constructor_name (basetype))
|| (TREE_CODE (basetype) == ENUMERAL_TYPE
&& name == TYPE_IDENTIFIER (basetype)))
return true;
*************** standard_conversion (tree to, tree from,
*** 732,739 ****
else if (!same_type_p (fbase, tbase))
return NULL;
}
! else if (IS_AGGR_TYPE (TREE_TYPE (from))
! && IS_AGGR_TYPE (TREE_TYPE (to))
/* [conv.ptr]
An rvalue of type "pointer to cv D," where D is a
--- 733,740 ----
else if (!same_type_p (fbase, tbase))
return NULL;
}
! else if (MAYBE_CLASS_TYPE_P (TREE_TYPE (from))
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (to))
/* [conv.ptr]
An rvalue of type "pointer to cv D," where D is a
*************** standard_conversion (tree to, tree from,
*** 849,855 ****
else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
&& vector_types_convertible_p (from, to, false))
return build_conv (ck_std, to, conv);
! else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
&& is_properly_derived_from (from, to))
{
if (conv->kind == ck_rvalue)
--- 850,856 ----
else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
&& vector_types_convertible_p (from, to, false))
return build_conv (ck_std, to, conv);
! else if (MAYBE_CLASS_TYPE_P (to) && MAYBE_CLASS_TYPE_P (from)
&& is_properly_derived_from (from, to))
{
if (conv->kind == ck_rvalue)
*************** implicit_conversion (tree to, tree from,
*** 1295,1302 ****
return conv;
if (expr != NULL_TREE
! && (IS_AGGR_TYPE (from)
! || IS_AGGR_TYPE (to))
&& (flags & LOOKUP_NO_CONVERSION) == 0)
{
struct z_candidate *cand;
--- 1296,1303 ----
return conv;
if (expr != NULL_TREE
! && (MAYBE_CLASS_TYPE_P (from)
! || MAYBE_CLASS_TYPE_P (to))
&& (flags & LOOKUP_NO_CONVERSION) == 0)
{
struct z_candidate *cand;
*************** add_builtin_candidate (struct z_candidat
*** 1752,1758 ****
tree c1 = TREE_TYPE (type1);
tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
! if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
&& (TYPE_PTRMEMFUNC_P (type2)
|| is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2))))
break;
--- 1753,1759 ----
tree c1 = TREE_TYPE (type1);
tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
! if (MAYBE_CLASS_TYPE_P (c1) && DERIVED_FROM_P (c2, c1)
&& (TYPE_PTRMEMFUNC_P (type2)
|| is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2))))
break;
*************** add_builtin_candidate (struct z_candidat
*** 2023,2029 ****
|| (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
|| (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
|| TYPE_PTRMEMFUNC_P (type1)
! || IS_AGGR_TYPE (type1)
|| TREE_CODE (type1) == ENUMERAL_TYPE))
{
build_builtin_candidate
--- 2024,2030 ----
|| (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
|| (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
|| TYPE_PTRMEMFUNC_P (type1)
! || MAYBE_CLASS_TYPE_P (type1)
|| TREE_CODE (type1) == ENUMERAL_TYPE))
{
build_builtin_candidate
*************** add_builtin_candidates (struct z_candida
*** 2140,2146 ****
{
if (! args[i])
;
! else if (IS_AGGR_TYPE (argtypes[i]))
{
tree convs;
--- 2141,2147 ----
{
if (! args[i])
;
! else if (MAYBE_CLASS_TYPE_P (argtypes[i]))
{
tree convs;
*************** build_user_type_conversion_1 (tree totyp
*** 2567,2579 ****
/* We represent conversion within a hierarchy using RVALUE_CONV and
BASE_CONV, as specified by [over.best.ics]; these become plain
constructor calls, as specified in [dcl.init]. */
! gcc_assert (!IS_AGGR_TYPE (fromtype) || !IS_AGGR_TYPE (totype)
|| !DERIVED_FROM_P (totype, fromtype));
! if (IS_AGGR_TYPE (totype))
ctors = lookup_fnfields (totype, complete_ctor_identifier, 0);
! if (IS_AGGR_TYPE (fromtype))
{
tree to_nonref = non_reference (totype);
if (same_type_ignoring_top_level_qualifiers_p (to_nonref, fromtype) ||
--- 2568,2580 ----
/* We represent conversion within a hierarchy using RVALUE_CONV and
BASE_CONV, as specified by [over.best.ics]; these become plain
constructor calls, as specified in [dcl.init]. */
! gcc_assert (!MAYBE_CLASS_TYPE_P (fromtype) || !MAYBE_CLASS_TYPE_P (totype)
|| !DERIVED_FROM_P (totype, fromtype));
! if (MAYBE_CLASS_TYPE_P (totype))
ctors = lookup_fnfields (totype, complete_ctor_identifier, 0);
! if (MAYBE_CLASS_TYPE_P (fromtype))
{
tree to_nonref = non_reference (totype);
if (same_type_ignoring_top_level_qualifiers_p (to_nonref, fromtype) ||
*************** convert_like_real (conversion *convs, tr
*** 4380,4386 ****
conversion, but is not considered during overload resolution.
If the target is a class, that means call a ctor. */
! if (IS_AGGR_TYPE (totype)
&& (inner >= 0 || !lvalue_p (expr)))
{
expr = (build_temp
--- 4381,4387 ----
conversion, but is not considered during overload resolution.
If the target is a class, that means call a ctor. */
! if (MAYBE_CLASS_TYPE_P (totype)
&& (inner >= 0 || !lvalue_p (expr)))
{
expr = (build_temp
*************** convert_like_real (conversion *convs, tr
*** 4442,4448 ****
{
case ck_rvalue:
expr = convert_bitfield_to_declared_type (expr);
! if (! IS_AGGR_TYPE (totype))
return expr;
/* Else fall through. */
case ck_base:
--- 4443,4449 ----
{
case ck_rvalue:
expr = convert_bitfield_to_declared_type (expr);
! if (! MAYBE_CLASS_TYPE_P (totype))
return expr;
/* Else fall through. */
case ck_base:
*************** build_cxx_call (tree fn, int nargs, tree
*** 5192,5198 ****
if (fn == error_mark_node)
return error_mark_node;
! if (IS_AGGR_TYPE (TREE_TYPE (fn)))
fn = build_cplus_new (TREE_TYPE (fn), fn);
return convert_from_reference (fn);
}
--- 5193,5199 ----
if (fn == error_mark_node)
return error_mark_node;
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (fn)))
fn = build_cplus_new (TREE_TYPE (fn), fn);
return convert_from_reference (fn);
}
*************** is_subseq (conversion *ics1, conversion
*** 5741,5748 ****
bool
is_properly_derived_from (tree derived, tree base)
{
! if (!IS_AGGR_TYPE_CODE (TREE_CODE (derived))
! || !IS_AGGR_TYPE_CODE (TREE_CODE (base)))
return false;
/* We only allow proper derivation here. The DERIVED_FROM_P macro
--- 5742,5748 ----
bool
is_properly_derived_from (tree derived, tree base)
{
! if (!CLASS_TYPE_P (derived) || !CLASS_TYPE_P (base))
return false;
/* We only allow proper derivation here. The DERIVED_FROM_P macro
*************** compare_ics (conversion *ics1, conversio
*** 6020,6027 ****
}
if (deref_from_type1 != NULL_TREE
! && IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type1))
! && IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type2)))
{
/* This was one of the pointer or pointer-like conversions.
--- 6020,6027 ----
}
if (deref_from_type1 != NULL_TREE
! && RECORD_OR_UNION_CODE_P (TREE_CODE (deref_from_type1))
! && RECORD_OR_UNION_CODE_P (TREE_CODE (deref_from_type2)))
{
/* This was one of the pointer or pointer-like conversions.
*************** compare_ics (conversion *ics1, conversio
*** 6058,6065 ****
return -1;
}
}
! else if (IS_AGGR_TYPE_CODE (TREE_CODE (deref_to_type1))
! && IS_AGGR_TYPE_CODE (TREE_CODE (deref_to_type2)))
{
/* [over.ics.rank]
--- 6058,6065 ----
return -1;
}
}
! else if (RECORD_OR_UNION_CODE_P (TREE_CODE (deref_to_type1))
! && RECORD_OR_UNION_CODE_P (TREE_CODE (deref_to_type2)))
{
/* [over.ics.rank]
Index: method.c
===================================================================
*** method.c (revision 133188)
--- method.c (working copy)
***************
*** 1,7 ****
/* Handle the hair of processing (but not expanding) inline functions.
Also manage function and variable name overloading.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
--- 1,7 ----
/* Handle the hair of processing (but not expanding) inline functions.
Also manage function and variable name overloading.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
*************** use_thunk (tree thunk_fndecl, bool emit_
*** 507,513 ****
t = build3 (COND_EXPR, TREE_TYPE (t), cond, t,
cp_convert (TREE_TYPE (t), integer_zero_node));
}
! if (IS_AGGR_TYPE (TREE_TYPE (t)))
t = build_cplus_new (TREE_TYPE (t), t);
finish_return_stmt (t);
}
--- 507,513 ----
t = build3 (COND_EXPR, TREE_TYPE (t), cond, t,
cp_convert (TREE_TYPE (t), integer_zero_node));
}
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (t)))
t = build_cplus_new (TREE_TYPE (t), t);
finish_return_stmt (t);
}
Index: rtti.c
===================================================================
*** rtti.c (revision 133188)
--- rtti.c (working copy)
*************** build_dynamic_cast_1 (tree type, tree ex
*** 503,509 ****
break;
/* Fall through. */
case REFERENCE_TYPE:
! if (! IS_AGGR_TYPE (TREE_TYPE (type)))
{
errstr = "target is not pointer or reference to class";
goto fail;
--- 503,509 ----
break;
/* Fall through. */
case REFERENCE_TYPE:
! if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (type)))
{
errstr = "target is not pointer or reference to class";
goto fail;
*************** build_dynamic_cast_1 (tree type, tree ex
*** 530,536 ****
errstr = "source is not a pointer";
goto fail;
}
! if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
{
errstr = "source is not a pointer to class";
goto fail;
--- 530,536 ----
errstr = "source is not a pointer";
goto fail;
}
! if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype)))
{
errstr = "source is not a pointer to class";
goto fail;
*************** build_dynamic_cast_1 (tree type, tree ex
*** 548,554 ****
/* T is a reference type, v shall be an lvalue of a complete class
type, and the result is an lvalue of the type referred to by T. */
! if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
{
errstr = "source is not of class type";
goto fail;
--- 548,554 ----
/* T is a reference type, v shall be an lvalue of a complete class
type, and the result is an lvalue of the type referred to by T. */
! if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype)))
{
errstr = "source is not of class type";
goto fail;
*************** create_pseudo_type_info (int tk, const c
*** 1167,1173 ****
}
/* Create the pseudo type. */
! pseudo_type = make_aggr_type (RECORD_TYPE);
finish_builtin_struct (pseudo_type, pseudo_name, fields, NULL_TREE);
CLASSTYPE_AS_BASE (pseudo_type) = pseudo_type;
--- 1167,1173 ----
}
/* Create the pseudo type. */
! pseudo_type = make_class_type (RECORD_TYPE);
finish_builtin_struct (pseudo_type, pseudo_name, fields, NULL_TREE);
CLASSTYPE_AS_BASE (pseudo_type) = pseudo_type;
*************** create_tinfo_types (void)
*** 1326,1332 ****
fields = field;
ti = VEC_index (tinfo_s, tinfo_descs, TK_TYPE_INFO_TYPE);
! ti->type = make_aggr_type (RECORD_TYPE);
ti->vtable = NULL_TREE;
ti->name = NULL_TREE;
finish_builtin_struct (ti->type, "__type_info_pseudo",
--- 1326,1332 ----
fields = field;
ti = VEC_index (tinfo_s, tinfo_descs, TK_TYPE_INFO_TYPE);
! ti->type = make_class_type (RECORD_TYPE);
ti->vtable = NULL_TREE;
ti->name = NULL_TREE;
finish_builtin_struct (ti->type, "__type_info_pseudo",
*************** create_tinfo_types (void)
*** 1364,1370 ****
ti = VEC_index (tinfo_s, tinfo_descs, TK_BASE_TYPE);
! ti->type = make_aggr_type (RECORD_TYPE);
ti->vtable = NULL_TREE;
ti->name = NULL_TREE;
finish_builtin_struct (ti->type, "__base_class_type_info_pseudo",
--- 1364,1370 ----
ti = VEC_index (tinfo_s, tinfo_descs, TK_BASE_TYPE);
! ti->type = make_class_type (RECORD_TYPE);
ti->vtable = NULL_TREE;
ti->name = NULL_TREE;
finish_builtin_struct (ti->type, "__base_class_type_info_pseudo",
Index: cvt.c
===================================================================
*** cvt.c (revision 133188)
--- cvt.c (working copy)
***************
*** 1,6 ****
/* Language-level data type conversion for GNU C++.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
--- 1,6 ----
/* Language-level data type conversion for GNU C++.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
*************** cp_convert_to_pointer (tree type, tree e
*** 82,88 ****
if (intype == error_mark_node)
return error_mark_node;
! if (IS_AGGR_TYPE (intype))
{
intype = complete_type (intype);
if (!COMPLETE_TYPE_P (intype))
--- 82,88 ----
if (intype == error_mark_node)
return error_mark_node;
! if (MAYBE_CLASS_TYPE_P (intype))
{
intype = complete_type (intype);
if (!COMPLETE_TYPE_P (intype))
*************** cp_convert_to_pointer (tree type, tree e
*** 127,134 ****
if (TYPE_MAIN_VARIANT (type) != intype
&& TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
! && IS_AGGR_TYPE (TREE_TYPE (type))
! && IS_AGGR_TYPE (TREE_TYPE (intype))
&& TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
{
enum tree_code code = PLUS_EXPR;
--- 127,134 ----
if (TYPE_MAIN_VARIANT (type) != intype
&& TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (type))
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (intype))
&& TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
{
enum tree_code code = PLUS_EXPR;
*************** convert_to_pointer_force (tree type, tre
*** 256,263 ****
if (TYPE_MAIN_VARIANT (type) != intype
&& TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
! && IS_AGGR_TYPE (TREE_TYPE (type))
! && IS_AGGR_TYPE (TREE_TYPE (intype))
&& TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
{
enum tree_code code = PLUS_EXPR;
--- 256,263 ----
if (TYPE_MAIN_VARIANT (type) != intype
&& TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (type))
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (intype))
&& TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
{
enum tree_code code = PLUS_EXPR;
*************** build_up_reference (tree type, tree arg,
*** 332,339 ****
if ((flags & LOOKUP_PROTECT)
&& TYPE_MAIN_VARIANT (argtype) != TYPE_MAIN_VARIANT (target_type)
! && IS_AGGR_TYPE (argtype)
! && IS_AGGR_TYPE (target_type))
{
/* We go through lookup_base for the access control. */
tree binfo = lookup_base (argtype, target_type, ba_check, NULL);
--- 332,339 ----
if ((flags & LOOKUP_PROTECT)
&& TYPE_MAIN_VARIANT (argtype) != TYPE_MAIN_VARIANT (target_type)
! && MAYBE_CLASS_TYPE_P (argtype)
! && MAYBE_CLASS_TYPE_P (target_type))
{
/* We go through lookup_base for the access control. */
tree binfo = lookup_base (argtype, target_type, ba_check, NULL);
*************** convert_to_reference (tree reftype, tree
*** 418,424 ****
can_convert_intype_to_type = can_convert (type, intype);
if (!can_convert_intype_to_type
! && (convtype & CONV_IMPLICIT) && IS_AGGR_TYPE (intype)
&& ! (flags & LOOKUP_NO_CONVERSION))
{
/* Look for a user-defined conversion to lvalue that we can use. */
--- 418,424 ----
can_convert_intype_to_type = can_convert (type, intype);
if (!can_convert_intype_to_type
! && (convtype & CONV_IMPLICIT) && MAYBE_CLASS_TYPE_P (intype)
&& ! (flags & LOOKUP_NO_CONVERSION))
{
/* Look for a user-defined conversion to lvalue that we can use. */
*************** convert_from_reference (tree val)
*** 530,536 ****
tree
force_rvalue (tree expr)
{
! if (IS_AGGR_TYPE (TREE_TYPE (expr)) && TREE_CODE (expr) != TARGET_EXPR)
expr = ocp_convert (TREE_TYPE (expr), expr,
CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
else
--- 530,536 ----
tree
force_rvalue (tree expr)
{
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (expr)) && TREE_CODE (expr) != TARGET_EXPR)
expr = ocp_convert (TREE_TYPE (expr), expr,
CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
else
*************** ocp_convert (tree type, tree expr, int c
*** 596,602 ****
e = integral_constant_value (e);
! if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP))
/* We need a new temporary; don't take this shortcut. */;
else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
{
--- 596,602 ----
e = integral_constant_value (e);
! if (MAYBE_CLASS_TYPE_P (type) && (convtype & CONV_FORCE_TEMP))
/* We need a new temporary; don't take this shortcut. */;
else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
{
*************** ocp_convert (tree type, tree expr, int c
*** 651,657 ****
if (!flag_permissive)
return error_mark_node;
}
! if (IS_AGGR_TYPE (intype))
{
tree rval;
rval = build_type_conversion (type, e);
--- 651,657 ----
if (!flag_permissive)
return error_mark_node;
}
! if (MAYBE_CLASS_TYPE_P (intype))
{
tree rval;
rval = build_type_conversion (type, e);
*************** ocp_convert (tree type, tree expr, int c
*** 671,677 ****
if (code == VECTOR_TYPE)
{
tree in_vtype = TREE_TYPE (e);
! if (IS_AGGR_TYPE (in_vtype))
{
tree ret_val;
ret_val = build_type_conversion (type, e);
--- 671,677 ----
if (code == VECTOR_TYPE)
{
tree in_vtype = TREE_TYPE (e);
! if (MAYBE_CLASS_TYPE_P (in_vtype))
{
tree ret_val;
ret_val = build_type_conversion (type, e);
*************** ocp_convert (tree type, tree expr, int c
*** 685,691 ****
}
if (code == REAL_TYPE || code == COMPLEX_TYPE)
{
! if (IS_AGGR_TYPE (TREE_TYPE (e)))
{
tree rval;
rval = build_type_conversion (type, e);
--- 685,691 ----
}
if (code == REAL_TYPE || code == COMPLEX_TYPE)
{
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (e)))
{
tree rval;
rval = build_type_conversion (type, e);
*************** ocp_convert (tree type, tree expr, int c
*** 705,711 ****
/* New C++ semantics: since assignment is now based on
memberwise copying, if the rhs type is derived from the
lhs type, then we may still do a conversion. */
! if (IS_AGGR_TYPE_CODE (code))
{
tree dtype = TREE_TYPE (e);
tree ctor = NULL_TREE;
--- 705,711 ----
/* New C++ semantics: since assignment is now based on
memberwise copying, if the rhs type is derived from the
lhs type, then we may still do a conversion. */
! if (RECORD_OR_UNION_CODE_P (code))
{
tree dtype = TREE_TYPE (e);
tree ctor = NULL_TREE;
*************** ocp_convert (tree type, tree expr, int c
*** 725,731 ****
return error_mark_node;
if ((flags & LOOKUP_ONLYCONVERTING)
! && ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype)))
/* For copy-initialization, first we create a temp of the proper type
with a user-defined conversion sequence, then we direct-initialize
the target with the temp (see [dcl.init]). */
--- 725,731 ----
return error_mark_node;
if ((flags & LOOKUP_ONLYCONVERTING)
! && ! (MAYBE_CLASS_TYPE_P (dtype) && DERIVED_FROM_P (type, dtype)))
/* For copy-initialization, first we create a temp of the proper type
with a user-defined conversion sequence, then we direct-initialize
the target with the temp (see [dcl.init]). */
*************** build_expr_type_conversion (int desires,
*** 1065,1071 ****
if (basetype == error_mark_node)
return error_mark_node;
! if (! IS_AGGR_TYPE (basetype))
switch (TREE_CODE (basetype))
{
case INTEGER_TYPE:
--- 1065,1071 ----
if (basetype == error_mark_node)
return error_mark_node;
! if (! MAYBE_CLASS_TYPE_P (basetype))
switch (TREE_CODE (basetype))
{
case INTEGER_TYPE:
Index: tree.c
===================================================================
*** tree.c (revision 133188)
--- tree.c (working copy)
*************** bind_template_template_parm (tree t, tre
*** 1238,1244 ****
tree decl = TYPE_NAME (t);
tree t2;
! t2 = make_aggr_type (BOUND_TEMPLATE_TEMPLATE_PARM);
decl = build_decl (TYPE_DECL, DECL_NAME (decl), NULL_TREE);
/* These nodes have to be created to reflect new TYPE_DECL and template
--- 1238,1244 ----
tree decl = TYPE_NAME (t);
tree t2;
! t2 = cxx_make_type (BOUND_TEMPLATE_TEMPLATE_PARM);
decl = build_decl (TYPE_DECL, DECL_NAME (decl), NULL_TREE);
/* These nodes have to be created to reflect new TYPE_DECL and template
*************** error_type (tree arg)
*** 1958,1964 ****
;
else if (real_lvalue_p (arg))
type = build_reference_type (lvalue_type (arg));
! else if (IS_AGGR_TYPE (type))
type = lvalue_type (arg);
return type;
--- 1958,1964 ----
;
else if (real_lvalue_p (arg))
type = build_reference_type (lvalue_type (arg));
! else if (MAYBE_CLASS_TYPE_P (type))
type = lvalue_type (arg);
return type;
Index: cp-tree.h
===================================================================
*** cp-tree.h (revision 133188)
--- cp-tree.h (working copy)
***************
*** 1,6 ****
/* Definitions for C++ parsing and type checking.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
! 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
--- 1,6 ----
/* Definitions for C++ parsing and type checking.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
! 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
*************** struct diagnostic_info;
*** 95,101 ****
2: Unused
3: TYPE_FOR_JAVA.
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
! 5: IS_AGGR_TYPE.
6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
--- 95,101 ----
2: Unused
3: TYPE_FOR_JAVA.
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
! 5: CLASS_TYPE_P.
6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
*************** enum languages { lang_c, lang_cplusplus,
*** 958,968 ****
/* Nonzero if T is a class (or struct or union) type. Also nonzero
for template type parameters, typename types, and instantiated
! template template parameters. Despite its name,
! this macro has nothing to do with the definition of aggregate given
! in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. Keep
! these checks in ascending code order. */
! #define IS_AGGR_TYPE(T) \
(TREE_CODE (T) == TEMPLATE_TYPE_PARM \
|| TREE_CODE (T) == TYPENAME_TYPE \
|| TREE_CODE (T) == TYPEOF_TYPE \
--- 958,966 ----
/* Nonzero if T is a class (or struct or union) type. Also nonzero
for template type parameters, typename types, and instantiated
! template template parameters. Keep these checks in ascending code
! order. */
! #define MAYBE_CLASS_TYPE_P(T) \
(TREE_CODE (T) == TEMPLATE_TYPE_PARM \
|| TREE_CODE (T) == TYPENAME_TYPE \
|| TREE_CODE (T) == TYPEOF_TYPE \
*************** enum languages { lang_c, lang_cplusplus,
*** 970,991 ****
|| TREE_CODE (T) == DECLTYPE_TYPE \
|| TYPE_LANG_FLAG_5 (T))
! /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
union type. */
! #define SET_IS_AGGR_TYPE(T, VAL) \
(TYPE_LANG_FLAG_5 (T) = (VAL))
/* Nonzero if T is a class type. Zero for template type parameters,
typename types, and so forth. */
#define CLASS_TYPE_P(T) \
! (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
/* Nonzero if T is a class type but not an union. */
#define NON_UNION_CLASS_TYPE_P(T) \
(CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE)
/* Keep these checks in ascending code order. */
! #define IS_AGGR_TYPE_CODE(T) \
((T) == RECORD_TYPE || (T) == UNION_TYPE)
#define TAGGED_TYPE_P(T) \
(CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
--- 968,989 ----
|| TREE_CODE (T) == DECLTYPE_TYPE \
|| TYPE_LANG_FLAG_5 (T))
! /* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or
union type. */
! #define SET_CLASS_TYPE_P(T, VAL) \
(TYPE_LANG_FLAG_5 (T) = (VAL))
/* Nonzero if T is a class type. Zero for template type parameters,
typename types, and so forth. */
#define CLASS_TYPE_P(T) \
! (RECORD_OR_UNION_CODE_P (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
/* Nonzero if T is a class type but not an union. */
#define NON_UNION_CLASS_TYPE_P(T) \
(CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE)
/* Keep these checks in ascending code order. */
! #define RECORD_OR_UNION_CODE_P(T) \
((T) == RECORD_TYPE || (T) == UNION_TYPE)
#define TAGGED_TYPE_P(T) \
(CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
*************** enum languages { lang_c, lang_cplusplus,
*** 1034,1044 ****
#define FUNCTION_FIRST_USER_PARM(NODE) \
skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
- #define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \
- (((CODE) == TREE_CODE (NODE) \
- && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
- || IS_AGGR_TYPE (NODE))
-
/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
ambiguity issues. */
#define DERIVED_FROM_P(PARENT, TYPE) \
--- 1032,1037 ----
*************** more_aggr_init_expr_args_p (const aggr_i
*** 2746,2752 ****
#define CLASSTYPE_NON_AGGREGATE(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
#define TYPE_NON_AGGREGATE_CLASS(NODE) \
! (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
/* Nonzero if there is a user-defined X::op=(x&) for this class. */
#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
--- 2739,2745 ----
#define CLASSTYPE_NON_AGGREGATE(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
#define TYPE_NON_AGGREGATE_CLASS(NODE) \
! (MAYBE_CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
/* Nonzero if there is a user-defined X::op=(x&) for this class. */
#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
*************** extern tree do_friend (tree, tree, tr
*** 4344,4350 ****
extern tree expand_member_init (tree);
extern void emit_mem_initializers (tree);
extern tree build_aggr_init (tree, tree, int);
! extern int is_aggr_type (tree, int);
extern tree get_type_value (tree);
extern tree build_zero_init (tree, tree, bool);
extern tree build_value_init (tree);
--- 4337,4343 ----
extern tree expand_member_init (tree);
extern void emit_mem_initializers (tree);
extern tree build_aggr_init (tree, tree, int);
! extern int is_class_type (tree, int);
extern tree get_type_value (tree);
extern tree build_zero_init (tree, tree, bool);
extern tree build_value_init (tree);
*************** extern void retrofit_lang_decl (tree);
*** 4374,4380 ****
extern tree copy_decl (tree);
extern tree copy_type (tree);
extern tree cxx_make_type (enum tree_code);
! extern tree make_aggr_type (enum tree_code);
extern void yyerror (const char *);
extern void yyhook (int);
extern bool cxx_init (void);
--- 4367,4373 ----
extern tree copy_decl (tree);
extern tree copy_type (tree);
extern tree cxx_make_type (enum tree_code);
! extern tree make_class_type (enum tree_code);
extern void yyerror (const char *);
extern void yyhook (int);
extern bool cxx_init (void);
Index: dump.c
===================================================================
*** dump.c (revision 133188)
--- dump.c (working copy)
***************
*** 1,5 ****
/* Tree-dumping functionality for intermediate representation.
! Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>
--- 1,5 ----
/* Tree-dumping functionality for intermediate representation.
! Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>
*************** cp_dump_tree (void* dump_info, tree t)
*** 257,263 ****
return true;
}
! if (! IS_AGGR_TYPE (t))
break;
dump_child ("vfld", TYPE_VFIELD (t));
--- 257,263 ----
return true;
}
! if (! MAYBE_CLASS_TYPE_P (t))
break;
dump_child ("vfld", TYPE_VFIELD (t));
Index: search.c
===================================================================
*** search.c (revision 133188)
--- search.c (working copy)
***************
*** 1,7 ****
/* Breadth-first and depth-first routines for
searching multiple-inheritance lattice for GNU C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
--- 1,8 ----
/* Breadth-first and depth-first routines for
searching multiple-inheritance lattice for GNU C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2002, 2003, 2004, 2005, 2007, 2008
! Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
*************** lookup_member (tree xbasetype, tree name
*** 1212,1218 ****
}
else
{
! if (!IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
return NULL_TREE;
type = xbasetype;
xbasetype = NULL_TREE;
--- 1213,1219 ----
}
else
{
! if (!RECORD_OR_UNION_CODE_P (TREE_CODE (xbasetype)))
return NULL_TREE;
type = xbasetype;
xbasetype = NULL_TREE;
Index: friend.c
===================================================================
*** friend.c (revision 133188)
--- friend.c (working copy)
***************
*** 1,6 ****
/* Help friends in C++.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
! 2007 Free Software Foundation, Inc.
This file is part of GCC.
--- 1,6 ----
/* Help friends in C++.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
! 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
*************** make_friend_class (tree type, tree frien
*** 227,233 ****
int class_template_depth = template_class_depth (type);
int friend_depth = processing_template_decl - class_template_depth;
! if (! IS_AGGR_TYPE (friend_type))
{
error ("invalid type %qT declared %<friend%>", friend_type);
return;
--- 227,233 ----
int class_template_depth = template_class_depth (type);
int friend_depth = processing_template_decl - class_template_depth;
! if (! MAYBE_CLASS_TYPE_P (friend_type))
{
error ("invalid type %qT declared %<friend%>", friend_type);
return;
*************** do_friend (tree ctype, tree declarator,
*** 408,414 ****
bool funcdef_flag)
{
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
! gcc_assert (!ctype || IS_AGGR_TYPE (ctype));
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
--- 408,414 ----
bool funcdef_flag)
{
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
! gcc_assert (!ctype || MAYBE_CLASS_TYPE_P (ctype));
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
Index: typeck2.c
===================================================================
*** typeck2.c (revision 133188)
--- typeck2.c (working copy)
***************
*** 1,7 ****
/* Report error messages, build initializers, and perform
some front-end optimizations for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
--- 1,7 ----
/* Report error messages, build initializers, and perform
some front-end optimizations for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
! 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
*************** store_init_value (tree decl, tree init)
*** 583,589 ****
if (TREE_CODE (type) == ERROR_MARK)
return NULL_TREE;
! if (IS_AGGR_TYPE (type))
{
gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type)
|| TREE_CODE (init) == CONSTRUCTOR);
--- 583,589 ----
if (TREE_CODE (type) == ERROR_MARK)
return NULL_TREE;
! if (MAYBE_CLASS_TYPE_P (type))
{
gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type)
|| TREE_CODE (init) == CONSTRUCTOR);
*************** process_init_constructor_array (tree typ
*** 848,854 ****
we can't rely on the back end to do it for us, so build up
TARGET_EXPRs. If the type in question is a class, just build
one up; if it's an array, recurse. */
! if (IS_AGGR_TYPE (TREE_TYPE (type)))
next = build_functional_cast (TREE_TYPE (type), NULL_TREE);
else
next = build_constructor (NULL_TREE, NULL);
--- 848,854 ----
we can't rely on the back end to do it for us, so build up
TARGET_EXPRs. If the type in question is a class, just build
one up; if it's an array, recurse. */
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (type)))
next = build_functional_cast (TREE_TYPE (type), NULL_TREE);
else
next = build_constructor (NULL_TREE, NULL);
*************** process_init_constructor_record (tree ty
*** 935,941 ****
default-initialization, we can't rely on the back end to do it
for us, so build up TARGET_EXPRs. If the type in question is
a class, just build one up; if it's an array, recurse. */
! if (IS_AGGR_TYPE (TREE_TYPE (field)))
next = build_functional_cast (TREE_TYPE (field), NULL_TREE);
else
next = build_constructor (NULL_TREE, NULL);
--- 935,941 ----
default-initialization, we can't rely on the back end to do it
for us, so build up TARGET_EXPRs. If the type in question is
a class, just build one up; if it's an array, recurse. */
! if (MAYBE_CLASS_TYPE_P (TREE_TYPE (field)))
next = build_functional_cast (TREE_TYPE (field), NULL_TREE);
else
next = build_constructor (NULL_TREE, NULL);
*************** build_x_arrow (tree expr)
*** 1161,1167 ****
expr = build_non_dependent_expr (expr);
}
! if (IS_AGGR_TYPE (type))
{
while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr,
NULL_TREE, NULL_TREE,
--- 1161,1167 ----
expr = build_non_dependent_expr (expr);
}
! if (MAYBE_CLASS_TYPE_P (type))
{
while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr,
NULL_TREE, NULL_TREE,
*************** build_m_component_ref (tree datum, tree
*** 1240,1246 ****
}
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
! if (! IS_AGGR_TYPE (objtype))
{
error ("cannot apply member pointer %qE to %qE, which is of "
"non-class type %qT",
--- 1240,1246 ----
}
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
! if (! MAYBE_CLASS_TYPE_P (objtype))
{
error ("cannot apply member pointer %qE to %qE, which is of "
"non-class type %qT",
*************** build_functional_cast (tree exp, tree pa
*** 1330,1336 ****
return t;
}
! if (! IS_AGGR_TYPE (type))
{
if (parms == NULL_TREE)
return cp_convert (type, integer_zero_node);
--- 1330,1336 ----
return t;
}
! if (! MAYBE_CLASS_TYPE_P (type))
{
if (parms == NULL_TREE)
return cp_convert (type, integer_zero_node);
Index: pt.c
===================================================================
*** pt.c (revision 133188)
--- pt.c (working copy)
*************** finish_member_template_decl (tree decl)
*** 238,244 ****
type = TREE_TYPE (decl);
if (type == error_mark_node)
return error_mark_node;
! if (IS_AGGR_TYPE (type)
&& CLASSTYPE_TEMPLATE_INFO (type)
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION (type))
{
--- 238,244 ----
type = TREE_TYPE (decl);
if (type == error_mark_node)
return error_mark_node;
! if (MAYBE_CLASS_TYPE_P (type)
&& CLASSTYPE_TEMPLATE_INFO (type)
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION (type))
{
*************** process_template_parm (tree list, tree p
*** 3041,3047 ****
if (parm && TREE_CODE (parm) == TEMPLATE_DECL)
{
! t = make_aggr_type (TEMPLATE_TEMPLATE_PARM);
/* This is for distinguishing between real templates and template
template parameters */
TREE_TYPE (parm) = t;
--- 3041,3047 ----
if (parm && TREE_CODE (parm) == TEMPLATE_DECL)
{
! t = cxx_make_type (TEMPLATE_TEMPLATE_PARM);
/* This is for distinguishing between real templates and template
template parameters */
TREE_TYPE (parm) = t;
*************** process_template_parm (tree list, tree p
*** 3050,3056 ****
}
else
{
! t = make_aggr_type (TEMPLATE_TYPE_PARM);
/* parm is either IDENTIFIER_NODE or NULL_TREE. */
decl = build_decl (TYPE_DECL, parm, t);
}
--- 3050,3056 ----
}
else
{
! t = cxx_make_type (TEMPLATE_TYPE_PARM);
/* parm is either IDENTIFIER_NODE or NULL_TREE. */
decl = build_decl (TYPE_DECL, parm, t);
}
*************** lookup_template_class (tree d1,
*** 5473,5479 ****
if (template)
context = DECL_CONTEXT (template);
}
! else if (TREE_CODE (d1) == TYPE_DECL && IS_AGGR_TYPE (TREE_TYPE (d1)))
{
tree type = TREE_TYPE (d1);
--- 5473,5479 ----
if (template)
context = DECL_CONTEXT (template);
}
! else if (TREE_CODE (d1) == TYPE_DECL && MAYBE_CLASS_TYPE_P (TREE_TYPE (d1)))
{
tree type = TREE_TYPE (d1);
*************** lookup_template_class (tree d1,
*** 5489,5495 ****
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
! || (TYPE_P (d1) && IS_AGGR_TYPE (d1)))
{
template = TYPE_TI_TEMPLATE (d1);
d1 = DECL_NAME (template);
--- 5489,5495 ----
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
! || (TYPE_P (d1) && MAYBE_CLASS_TYPE_P (d1)))
{
template = TYPE_TI_TEMPLATE (d1);
d1 = DECL_NAME (template);
*************** lookup_template_class (tree d1,
*** 5762,5768 ****
}
else
{
! t = make_aggr_type (TREE_CODE (template_type));
CLASSTYPE_DECLARED_CLASS (t)
= CLASSTYPE_DECLARED_CLASS (template_type);
SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t);
--- 5762,5768 ----
}
else
{
! t = make_class_type (TREE_CODE (template_type));
CLASSTYPE_DECLARED_CLASS (t)
= CLASSTYPE_DECLARED_CLASS (template_type);
SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t);
*************** tsubst_function_type (tree t,
*** 8673,8679 ****
else
{
tree r = TREE_TYPE (TREE_VALUE (arg_types));
! if (! IS_AGGR_TYPE (r))
{
/* [temp.deduct]
--- 8673,8679 ----
else
{
tree r = TREE_TYPE (TREE_VALUE (arg_types));
! if (! MAYBE_CLASS_TYPE_P (r))
{
/* [temp.deduct]
*************** tsubst (tree t, tree args, tsubst_flags_
*** 9202,9208 ****
case OFFSET_TYPE:
{
r = tsubst (TYPE_OFFSET_BASETYPE (t), args, complain, in_decl);
! if (r == error_mark_node || !IS_AGGR_TYPE (r))
{
/* [temp.deduct]
--- 9202,9208 ----
case OFFSET_TYPE:
{
r = tsubst (TYPE_OFFSET_BASETYPE (t), args, complain, in_decl);
! if (r == error_mark_node || !MAYBE_CLASS_TYPE_P (r))
{
/* [temp.deduct]
*************** tsubst (tree t, tree args, tsubst_flags_
*** 9345,9351 ****
if (ctx == error_mark_node || f == error_mark_node)
return error_mark_node;
! if (!IS_AGGR_TYPE (ctx))
{
if (complain & tf_error)
error ("%qT is not a class, struct, or union type", ctx);
--- 9345,9351 ----
if (ctx == error_mark_node || f == error_mark_node)
return error_mark_node;
! if (!MAYBE_CLASS_TYPE_P (ctx))
{
if (complain & tf_error)
error ("%qT is not a class, struct, or union type", ctx);
*************** tsubst_copy_and_build (tree t,
*** 11211,11217 ****
/* We do not want to process the index of aggregate
initializers as they are identifier nodes which will be
looked up by digest_init. */
! process_index_p = !(type && IS_AGGR_TYPE (type));
n = VEC_copy (constructor_elt, gc, CONSTRUCTOR_ELTS (t));
newlen = VEC_length (constructor_elt, n);
--- 11211,11217 ----
/* We do not want to process the index of aggregate
initializers as they are identifier nodes which will be
looked up by digest_init. */
! process_index_p = !(type && MAYBE_CLASS_TYPE_P (type));
n = VEC_copy (constructor_elt, gc, CONSTRUCTOR_ELTS (t));
newlen = VEC_length (constructor_elt, n);
*************** get_template_base (tree tparms, tree tar
*** 12325,12331 ****
tree rval = NULL_TREE;
tree binfo;
! gcc_assert (IS_AGGR_TYPE_CODE (TREE_CODE (arg)));
binfo = TYPE_BINFO (complete_type (arg));
if (!binfo)
--- 12325,12331 ----
tree rval = NULL_TREE;
tree binfo;
! gcc_assert (RECORD_OR_UNION_CODE_P (TREE_CODE (arg)));
binfo = TYPE_BINFO (complete_type (arg));
if (!binfo)
*************** bt_instantiate_type_proc (binding_entry
*** 14317,14323 ****
{
tree storage = *(tree *) data;
! if (IS_AGGR_TYPE (entry->type)
&& !uses_template_parms (CLASSTYPE_TI_ARGS (entry->type)))
do_type_instantiation (TYPE_MAIN_DECL (entry->type), storage, 0);
}
--- 14317,14323 ----
{
tree storage = *(tree *) data;
! if (MAYBE_CLASS_TYPE_P (entry->type)
&& !uses_template_parms (CLASSTYPE_TI_ARGS (entry->type)))
do_type_instantiation (TYPE_MAIN_DECL (entry->type), storage, 0);
}
Index: semantics.c
===================================================================
*** semantics.c (revision 133188)
--- semantics.c (working copy)
*************** begin_class_definition (tree t, tree att
*** 2254,2262 ****
t = error_mark_node;
}
! if (t == error_mark_node || ! IS_AGGR_TYPE (t))
{
! t = make_aggr_type (RECORD_TYPE);
pushtag (make_anon_name (), t, /*tag_scope=*/ts_current);
}
--- 2254,2262 ----
t = error_mark_node;
}
! if (t == error_mark_node || ! MAYBE_CLASS_TYPE_P (t))
{
! t = make_class_type (RECORD_TYPE);
pushtag (make_anon_name (), t, /*tag_scope=*/ts_current);
}
*************** begin_class_definition (tree t, tree att
*** 2265,2271 ****
if (TYPE_BEING_DEFINED (t))
{
! t = make_aggr_type (TREE_CODE (t));
pushtag (TYPE_IDENTIFIER (t), t, /*tag_scope=*/ts_current);
}
maybe_process_partial_specialization (t);
--- 2265,2271 ----
if (TYPE_BEING_DEFINED (t))
{
! t = make_class_type (TREE_CODE (t));
pushtag (TYPE_IDENTIFIER (t), t, /*tag_scope=*/ts_current);
}
maybe_process_partial_specialization (t);
*************** finish_base_specifier (tree base, tree a
*** 2469,2476 ****
error ("invalid base-class specification");
result = NULL_TREE;
}
! else if (! is_aggr_type (base, 1))
! result = NULL_TREE;
else
{
if (cp_type_quals (base) != 0)
--- 2469,2479 ----
error ("invalid base-class specification");
result = NULL_TREE;
}
! else if (! MAYBE_CLASS_TYPE_P (base))
! {
! error ("%qT is not a class type", base);
! result = NULL_TREE;
! }
else
{
if (cp_type_quals (base) != 0)
*************** finish_typeof (tree expr)
*** 2988,2994 ****
if (type_dependent_expression_p (expr))
{
! type = make_aggr_type (TYPEOF_TYPE);
TYPEOF_TYPE_EXPR (type) = expr;
SET_TYPE_STRUCTURAL_EQUALITY (type);
--- 2991,2997 ----
if (type_dependent_expression_p (expr))
{
! type = cxx_make_type (TYPEOF_TYPE);
TYPEOF_TYPE_EXPR (type) = expr;
SET_TYPE_STRUCTURAL_EQUALITY (type);
*************** cxx_omp_predetermined_sharing (tree decl
*** 4030,4036 ****
if (TREE_STATIC (decl))
{
tree ctx = CP_DECL_CONTEXT (decl);
! if (TYPE_P (ctx) && IS_AGGR_TYPE (ctx))
return OMP_CLAUSE_DEFAULT_SHARED;
}
--- 4033,4039 ----
if (TREE_STATIC (decl))
{
tree ctx = CP_DECL_CONTEXT (decl);
! if (TYPE_P (ctx) && MAYBE_CLASS_TYPE_P (ctx))
return OMP_CLAUSE_DEFAULT_SHARED;
}
*************** finish_decltype_type (tree expr, bool id
*** 4123,4129 ****
if (type_dependent_expression_p (expr))
{
! type = make_aggr_type (DECLTYPE_TYPE);
DECLTYPE_TYPE_EXPR (type) = expr;
DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type)
= id_expression_or_member_access_p;
--- 4126,4132 ----
if (type_dependent_expression_p (expr))
{
! type = cxx_make_type (DECLTYPE_TYPE);
DECLTYPE_TYPE_EXPR (type) = expr;
DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type)
= id_expression_or_member_access_p;
Index: name-lookup.c
===================================================================
*** name-lookup.c (revision 133188)
--- name-lookup.c (working copy)
*************** constructor_name_p (tree name, tree type
*** 1737,1743 ****
{
tree ctor_name;
! gcc_assert (IS_AGGR_TYPE (type));
if (!name)
return false;
--- 1737,1743 ----
{
tree ctor_name;
! gcc_assert (MAYBE_CLASS_TYPE_P (type));
if (!name)
return false;
*************** push_overloaded_decl (tree decl, int fla
*** 1916,1922 ****
if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
{
tree t = TREE_TYPE (old);
! if (IS_AGGR_TYPE (t) && warn_shadow
&& (! DECL_IN_SYSTEM_HEADER (decl)
|| ! DECL_IN_SYSTEM_HEADER (old)))
warning (OPT_Wshadow, "%q#D hides constructor for %q#T", decl, t);
--- 1916,1922 ----
if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
{
tree t = TREE_TYPE (old);
! if (MAYBE_CLASS_TYPE_P (t) && warn_shadow
&& (! DECL_IN_SYSTEM_HEADER (decl)
|| ! DECL_IN_SYSTEM_HEADER (old)))
warning (OPT_Wshadow, "%q#D hides constructor for %q#T", decl, t);
*************** do_class_using_decl (tree scope, tree na
*** 2826,2832 ****
error ("%<%T::%D%> names destructor", scope, name);
return NULL_TREE;
}
! if (IS_AGGR_TYPE (scope) && constructor_name_p (name, scope))
{
error ("%<%T::%D%> names constructor", scope, name);
return NULL_TREE;
--- 2826,2832 ----
error ("%<%T::%D%> names destructor", scope, name);
return NULL_TREE;
}
! if (MAYBE_CLASS_TYPE_P (scope) && constructor_name_p (name, scope))
{
error ("%<%T::%D%> names constructor", scope, name);
return NULL_TREE;
*************** lookup_qualified_name (tree scope, tree
*** 3765,3771 ****
if (qualified_lookup_using_namespace (name, scope, &binding, flags))
t = binding.value;
}
! else if (is_aggr_type (scope, complain))
t = lookup_member (scope, name, 2, is_type_p);
if (!t)
--- 3765,3771 ----
if (qualified_lookup_using_namespace (name, scope, &binding, flags))
t = binding.value;
}
! else if (is_class_type (scope, complain))
t = lookup_member (scope, name, 2, is_type_p);
if (!t)
*************** maybe_process_template_type_declaration
*** 4826,4832 ****
;
else
{
! gcc_assert (IS_AGGR_TYPE (type) || TREE_CODE (type) == ENUMERAL_TYPE);
if (processing_template_decl)
{
--- 4826,4833 ----
;
else
{
! gcc_assert (MAYBE_CLASS_TYPE_P (type)
! || TREE_CODE (type) == ENUMERAL_TYPE);
if (processing_template_decl)
{
Index: lex.c
===================================================================
*** lex.c (revision 133188)
--- lex.c (working copy)
*************** cxx_make_type (enum tree_code code)
*** 801,807 ****
tree t = make_node (code);
/* Create lang_type structure. */
! if (IS_AGGR_TYPE_CODE (code)
|| code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
struct lang_type *pi = GGC_CNEW (struct lang_type);
--- 801,807 ----
tree t = make_node (code);
/* Create lang_type structure. */
! if (RECORD_OR_UNION_CODE_P (code)
|| code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
struct lang_type *pi = GGC_CNEW (struct lang_type);
*************** cxx_make_type (enum tree_code code)
*** 816,822 ****
}
/* Set up some flags that give proper default behavior. */
! if (IS_AGGR_TYPE_CODE (code))
{
struct c_fileinfo *finfo = get_fileinfo (input_filename);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
--- 816,822 ----
}
/* Set up some flags that give proper default behavior. */
! if (RECORD_OR_UNION_CODE_P (code))
{
struct c_fileinfo *finfo = get_fileinfo (input_filename);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
*************** cxx_make_type (enum tree_code code)
*** 827,839 ****
}
tree
! make_aggr_type (enum tree_code code)
{
tree t = cxx_make_type (code);
!
! if (IS_AGGR_TYPE_CODE (code))
! SET_IS_AGGR_TYPE (t, 1);
!
return t;
}
--- 827,836 ----
}
tree
! make_class_type (enum tree_code code)
{
tree t = cxx_make_type (code);
! SET_CLASS_TYPE_P (t, 1);
return t;
}
Index: decl2.c
===================================================================
*** decl2.c (revision 133188)
--- decl2.c (working copy)
*************** grok_array_decl (tree array_expr, tree i
*** 308,314 ****
type = non_reference (type);
/* If they have an `operator[]', use that. */
! if (IS_AGGR_TYPE (type) || IS_AGGR_TYPE (TREE_TYPE (index_exp)))
expr = build_new_op (ARRAY_REF, LOOKUP_NORMAL,
array_expr, index_exp, NULL_TREE,
/*overloaded_p=*/NULL);
--- 308,314 ----
type = non_reference (type);
/* If they have an `operator[]', use that. */
! if (MAYBE_CLASS_TYPE_P (type) || MAYBE_CLASS_TYPE_P (TREE_TYPE (index_exp)))
expr = build_new_op (ARRAY_REF, LOOKUP_NORMAL,
array_expr, index_exp, NULL_TREE,
/*overloaded_p=*/NULL);
*************** check_member_template (tree tmpl)
*** 443,449 ****
if (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == TYPE_DECL
! && IS_AGGR_TYPE (TREE_TYPE (decl))))
{
/* The parser rejects template declarations in local classes. */
gcc_assert (!current_function_decl);
--- 443,449 ----
if (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == TYPE_DECL
! && MAYBE_CLASS_TYPE_P (TREE_TYPE (decl))))
{
/* The parser rejects template declarations in local classes. */
gcc_assert (!current_function_decl);
*************** constrain_class_visibility (tree type)
*** 2029,2035 ****
%qT has a field %qD whose type uses the anonymous namespace",
type, t);
}
! else if (IS_AGGR_TYPE (ftype)
&& vis < VISIBILITY_HIDDEN
&& subvis >= VISIBILITY_HIDDEN)
warning (OPT_Wattributes, "\
--- 2029,2035 ----
%qT has a field %qD whose type uses the anonymous namespace",
type, t);
}
! else if (MAYBE_CLASS_TYPE_P (ftype)
&& vis < VISIBILITY_HIDDEN
&& subvis >= VISIBILITY_HIDDEN)
warning (OPT_Wattributes, "\
Index: parser.c
===================================================================
*** parser.c (revision 133188)
--- parser.c (working copy)
*************** cp_parser_class_name (cp_parser *parser,
*** 14224,14230 ****
}
else if (TREE_CODE (decl) != TYPE_DECL
|| TREE_TYPE (decl) == error_mark_node
! || !IS_AGGR_TYPE (TREE_TYPE (decl)))
decl = error_mark_node;
if (decl == error_mark_node)
--- 14224,14230 ----
}
else if (TREE_CODE (decl) != TYPE_DECL
|| TREE_TYPE (decl) == error_mark_node
! || !MAYBE_CLASS_TYPE_P (TREE_TYPE (decl)))
decl = error_mark_node;
if (decl == error_mark_node)