aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2008-03-21 18:56:51 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-03-21 18:56:51 +0000
commit9e1e64ec2b978e81924000db7d4009b92bb5a638 (patch)
tree28e5155485b87e7675ad708f94b5a26a8e4ea948
parentfc34570cc14662c34807b275ea7dd5c8ac310e9f (diff)
downloadgcc-9e1e64ec2b978e81924000db7d4009b92bb5a638.zip
gcc-9e1e64ec2b978e81924000db7d4009b92bb5a638.tar.gz
gcc-9e1e64ec2b978e81924000db7d4009b92bb5a638.tar.bz2
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P.
2008-03-21 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. From-SVN: r133434
-rw-r--r--gcc/cp/ChangeLog54
-rw-r--r--gcc/cp/call.c42
-rw-r--r--gcc/cp/class.c12
-rw-r--r--gcc/cp/cp-tree.h31
-rw-r--r--gcc/cp/cvt.c34
-rw-r--r--gcc/cp/decl.c49
-rw-r--r--gcc/cp/decl2.c6
-rw-r--r--gcc/cp/dump.c4
-rw-r--r--gcc/cp/friend.c6
-rw-r--r--gcc/cp/init.c20
-rw-r--r--gcc/cp/lex.c11
-rw-r--r--gcc/cp/method.c4
-rw-r--r--gcc/cp/name-lookup.c11
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/cp/pt.c24
-rw-r--r--gcc/cp/rtti.c12
-rw-r--r--gcc/cp/search.c5
-rw-r--r--gcc/cp/semantics.c19
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/cp/typeck.c14
-rw-r--r--gcc/cp/typeck2.c14
21 files changed, 215 insertions, 163 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a853465..eaaddc8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,57 @@
+2008-03-21 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.
+
2008-03-18 Paolo Bonzini <bonzini@gnu.org>
* cp-lang.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Delete.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3677262..41e6933 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -214,7 +214,8 @@ check_dtor_name (tree basetype, tree name)
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
{
- if ((IS_AGGR_TYPE (basetype) && name == constructor_name (basetype))
+ if ((MAYBE_CLASS_TYPE_P (basetype)
+ && name == constructor_name (basetype))
|| (TREE_CODE (basetype) == ENUMERAL_TYPE
&& name == TYPE_IDENTIFIER (basetype)))
return true;
@@ -732,8 +733,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
else if (!same_type_p (fbase, tbase))
return NULL;
}
- else if (IS_AGGR_TYPE (TREE_TYPE (from))
- && IS_AGGR_TYPE (TREE_TYPE (to))
+ 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
@@ -849,7 +850,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
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)
+ else if (MAYBE_CLASS_TYPE_P (to) && MAYBE_CLASS_TYPE_P (from)
&& is_properly_derived_from (from, to))
{
if (conv->kind == ck_rvalue)
@@ -1296,8 +1297,8 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
return conv;
if (expr != NULL_TREE
- && (IS_AGGR_TYPE (from)
- || IS_AGGR_TYPE (to))
+ && (MAYBE_CLASS_TYPE_P (from)
+ || MAYBE_CLASS_TYPE_P (to))
&& (flags & LOOKUP_NO_CONVERSION) == 0)
{
struct z_candidate *cand;
@@ -1753,7 +1754,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
tree c1 = TREE_TYPE (type1);
tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
- if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
+ if (MAYBE_CLASS_TYPE_P (c1) && DERIVED_FROM_P (c2, c1)
&& (TYPE_PTRMEMFUNC_P (type2)
|| is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2))))
break;
@@ -2024,7 +2025,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
|| (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
|| (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
|| TYPE_PTRMEMFUNC_P (type1)
- || IS_AGGR_TYPE (type1)
+ || MAYBE_CLASS_TYPE_P (type1)
|| TREE_CODE (type1) == ENUMERAL_TYPE))
{
build_builtin_candidate
@@ -2141,7 +2142,7 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
{
if (! args[i])
;
- else if (IS_AGGR_TYPE (argtypes[i]))
+ else if (MAYBE_CLASS_TYPE_P (argtypes[i]))
{
tree convs;
@@ -2568,13 +2569,13 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
/* 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)
+ gcc_assert (!MAYBE_CLASS_TYPE_P (fromtype) || !MAYBE_CLASS_TYPE_P (totype)
|| !DERIVED_FROM_P (totype, fromtype));
- if (IS_AGGR_TYPE (totype))
+ if (MAYBE_CLASS_TYPE_P (totype))
ctors = lookup_fnfields (totype, complete_ctor_identifier, 0);
- if (IS_AGGR_TYPE (fromtype))
+ if (MAYBE_CLASS_TYPE_P (fromtype))
{
tree to_nonref = non_reference (totype);
if (same_type_ignoring_top_level_qualifiers_p (to_nonref, fromtype) ||
@@ -4381,7 +4382,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
conversion, but is not considered during overload resolution.
If the target is a class, that means call a ctor. */
- if (IS_AGGR_TYPE (totype)
+ if (MAYBE_CLASS_TYPE_P (totype)
&& (inner >= 0 || !lvalue_p (expr)))
{
expr = (build_temp
@@ -4443,7 +4444,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
{
case ck_rvalue:
expr = convert_bitfield_to_declared_type (expr);
- if (! IS_AGGR_TYPE (totype))
+ if (! MAYBE_CLASS_TYPE_P (totype))
return expr;
/* Else fall through. */
case ck_base:
@@ -5193,7 +5194,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray)
if (fn == error_mark_node)
return error_mark_node;
- if (IS_AGGR_TYPE (TREE_TYPE (fn)))
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (fn)))
fn = build_cplus_new (TREE_TYPE (fn), fn);
return convert_from_reference (fn);
}
@@ -5742,8 +5743,7 @@ is_subseq (conversion *ics1, conversion *ics2)
bool
is_properly_derived_from (tree derived, tree base)
{
- if (!IS_AGGR_TYPE_CODE (TREE_CODE (derived))
- || !IS_AGGR_TYPE_CODE (TREE_CODE (base)))
+ if (!CLASS_TYPE_P (derived) || !CLASS_TYPE_P (base))
return false;
/* We only allow proper derivation here. The DERIVED_FROM_P macro
@@ -6021,8 +6021,8 @@ compare_ics (conversion *ics1, conversion *ics2)
}
if (deref_from_type1 != NULL_TREE
- && IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type1))
- && IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type2)))
+ && 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.
@@ -6059,8 +6059,8 @@ compare_ics (conversion *ics1, conversion *ics2)
return -1;
}
}
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (deref_to_type1))
- && IS_AGGR_TYPE_CODE (TREE_CODE (deref_to_type2)))
+ 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]
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 500ddaa..154c3b3 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1,6 +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
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
@@ -4926,7 +4926,7 @@ layout_class_type (tree t, tree *virtuals_p)
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
+ 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))
{
@@ -5086,7 +5086,7 @@ finish_struct_1 (tree t)
if (COMPLETE_TYPE_P (t))
{
- gcc_assert (IS_AGGR_TYPE (t));
+ gcc_assert (MAYBE_CLASS_TYPE_P (t));
error ("redefinition of %q#T", t);
popclass ();
return;
@@ -5432,7 +5432,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp)
case VAR_DECL:
case FIELD_DECL:
if (TREE_CODE (TREE_TYPE (instance)) == ARRAY_TYPE
- && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (instance))))
+ && MAYBE_CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (instance))))
{
if (nonnull)
*nonnull = 1;
@@ -5442,7 +5442,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp)
case TARGET_EXPR:
case PARM_DECL:
case RESULT_DECL:
- if (IS_AGGR_TYPE (TREE_TYPE (instance)))
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (instance)))
{
if (nonnull)
*nonnull = 1;
@@ -6343,7 +6343,7 @@ is_empty_class (tree type)
if (type == error_mark_node)
return 0;
- if (! IS_AGGR_TYPE (type))
+ if (! MAYBE_CLASS_TYPE_P (type))
return 0;
/* In G++ 3.2, whether or not a class was empty was determined by
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4f1a34b..9afeed7 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1,6 +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
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
@@ -95,7 +95,7 @@ struct diagnostic_info;
2: Unused
3: TYPE_FOR_JAVA.
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
- 5: IS_AGGR_TYPE.
+ 5: CLASS_TYPE_P.
6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
@@ -958,11 +958,9 @@ enum languages { lang_c, lang_cplusplus, lang_java };
/* 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) \
+ 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 \
@@ -970,22 +968,22 @@ enum languages { lang_c, lang_cplusplus, lang_java };
|| 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
+/* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or
union type. */
-#define SET_IS_AGGR_TYPE(T, VAL) \
+#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) \
- (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (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 IS_AGGR_TYPE_CODE(T) \
+#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)
@@ -1034,11 +1032,6 @@ enum languages { lang_c, lang_cplusplus, lang_java };
#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) \
@@ -2746,7 +2739,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#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))
+ (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)
@@ -4344,7 +4337,7 @@ extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool);
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 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);
@@ -4374,7 +4367,7 @@ extern void retrofit_lang_decl (tree);
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 tree make_class_type (enum tree_code);
extern void yyerror (const char *);
extern void yyhook (int);
extern bool cxx_init (void);
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 2911fea..64a8716 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -1,6 +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
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
@@ -82,7 +82,7 @@ cp_convert_to_pointer (tree type, tree expr)
if (intype == error_mark_node)
return error_mark_node;
- if (IS_AGGR_TYPE (intype))
+ if (MAYBE_CLASS_TYPE_P (intype))
{
intype = complete_type (intype);
if (!COMPLETE_TYPE_P (intype))
@@ -127,8 +127,8 @@ cp_convert_to_pointer (tree type, tree expr)
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))
+ && 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;
@@ -256,8 +256,8 @@ convert_to_pointer_force (tree type, tree expr)
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))
+ && 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;
@@ -332,8 +332,8 @@ build_up_reference (tree type, tree arg, int flags, tree decl)
if ((flags & LOOKUP_PROTECT)
&& TYPE_MAIN_VARIANT (argtype) != TYPE_MAIN_VARIANT (target_type)
- && IS_AGGR_TYPE (argtype)
- && IS_AGGR_TYPE (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);
@@ -418,7 +418,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
can_convert_intype_to_type = can_convert (type, intype);
if (!can_convert_intype_to_type
- && (convtype & CONV_IMPLICIT) && IS_AGGR_TYPE (intype)
+ && (convtype & CONV_IMPLICIT) && MAYBE_CLASS_TYPE_P (intype)
&& ! (flags & LOOKUP_NO_CONVERSION))
{
/* Look for a user-defined conversion to lvalue that we can use. */
@@ -530,7 +530,7 @@ convert_from_reference (tree val)
tree
force_rvalue (tree expr)
{
- if (IS_AGGR_TYPE (TREE_TYPE (expr)) && TREE_CODE (expr) != TARGET_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
@@ -596,7 +596,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
e = integral_constant_value (e);
- if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP))
+ 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)))
{
@@ -651,7 +651,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
if (!flag_permissive)
return error_mark_node;
}
- if (IS_AGGR_TYPE (intype))
+ if (MAYBE_CLASS_TYPE_P (intype))
{
tree rval;
rval = build_type_conversion (type, e);
@@ -671,7 +671,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
if (code == VECTOR_TYPE)
{
tree in_vtype = TREE_TYPE (e);
- if (IS_AGGR_TYPE (in_vtype))
+ if (MAYBE_CLASS_TYPE_P (in_vtype))
{
tree ret_val;
ret_val = build_type_conversion (type, e);
@@ -685,7 +685,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
}
if (code == REAL_TYPE || code == COMPLEX_TYPE)
{
- if (IS_AGGR_TYPE (TREE_TYPE (e)))
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (e)))
{
tree rval;
rval = build_type_conversion (type, e);
@@ -705,7 +705,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
/* 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))
+ if (RECORD_OR_UNION_CODE_P (code))
{
tree dtype = TREE_TYPE (e);
tree ctor = NULL_TREE;
@@ -725,7 +725,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
return error_mark_node;
if ((flags & LOOKUP_ONLYCONVERTING)
- && ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype)))
+ && ! (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]). */
@@ -1065,7 +1065,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
if (basetype == error_mark_node)
return error_mark_node;
- if (! IS_AGGR_TYPE (basetype))
+ if (! MAYBE_CLASS_TYPE_P (basetype))
switch (TREE_CODE (basetype))
{
case INTEGER_TYPE:
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2318f69..8353b9b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2891,7 +2891,7 @@ build_typename_type (tree context, tree name, tree fullname,
else
{
/* Build the TYPENAME_TYPE. */
- t = make_aggr_type (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;
@@ -2979,7 +2979,7 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
if (dependent_type_p (context))
return build_typename_type (context, name, fullname, tag_type);
- if (!IS_AGGR_TYPE (context))
+ if (!MAYBE_CLASS_TYPE_P (context))
{
if (complain & tf_error)
error ("%q#T is not a class", context);
@@ -3056,7 +3056,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list,
{
tree tmpl = NULL_TREE;
- if (IS_AGGR_TYPE (context))
+ if (MAYBE_CLASS_TYPE_P (context))
tmpl = lookup_field (context, name, 0, false);
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
@@ -3084,7 +3084,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list,
}
/* Build the UNBOUND_CLASS_TEMPLATE. */
- t = make_aggr_type (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);
@@ -3382,7 +3382,7 @@ cxx_init_decl_processing (void)
push_namespace (std_identifier);
bad_alloc_id = get_identifier ("bad_alloc");
- bad_alloc_type_node = make_aggr_type (RECORD_TYPE);
+ 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);
@@ -3773,7 +3773,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
if (declspecs->type
&& TYPE_P (declspecs->type)
&& ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
- && IS_AGGR_TYPE (declspecs->type))
+ && MAYBE_CLASS_TYPE_P (declspecs->type))
|| TREE_CODE (declspecs->type) == ENUMERAL_TYPE))
declared_type = declspecs->type;
else if (declspecs->type == error_mark_node)
@@ -3781,7 +3781,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
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))
+ 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
@@ -3910,7 +3910,7 @@ groktypename (cp_decl_specifier_seq *type_specifiers,
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))
+ 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);
@@ -4174,7 +4174,7 @@ start_decl_1 (tree decl, bool initialized)
type = TREE_TYPE (decl);
complete_p = COMPLETE_TYPE_P (type);
- aggregate_definition_p = IS_AGGR_TYPE (type) && !DECL_EXTERNAL (decl);
+ 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.
@@ -4427,7 +4427,7 @@ layout_var_decl (tree decl)
/* 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))
+ 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);
@@ -5054,7 +5054,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
;
else if (TYPE_P (type) && TYPE_NEEDS_CONSTRUCTING (type))
goto initialize_aggr;
- else if (IS_AGGR_TYPE (type))
+ else if (MAYBE_CLASS_TYPE_P (type))
{
tree core_type = strip_array_types (type);
@@ -5450,7 +5450,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
if (TREE_CODE (decl) == TYPE_DECL)
{
if (type != error_mark_node
- && IS_AGGR_TYPE (type) && DECL_NAME (decl))
+ && 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);
@@ -5504,7 +5504,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
is *not* defined. */
&& (!DECL_EXTERNAL (decl) || init))
{
- if (TYPE_FOR_JAVA (type) && IS_AGGR_TYPE (type))
+ if (TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type))
{
tree jclass
= IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass"));
@@ -5589,7 +5589,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
layout_type (type);
}
else if (TREE_CODE (decl) == FIELD_DECL
- && TYPE_FOR_JAVA (type) && IS_AGGR_TYPE (type))
+ && 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
@@ -6854,13 +6854,13 @@ build_ptrmemfunc_type (tree type)
unqualified_variant
= build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
- t = make_aggr_type (RECORD_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 an aggregate. */
- SET_IS_AGGR_TYPE (t, 0);
+ /* ... and not really a class type. */
+ SET_CLASS_TYPE_P (t, 0);
field = build_decl (FIELD_DECL, pfn_identifier, type);
fields = field;
@@ -9383,7 +9383,7 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms)
if (type != error_mark_node
&& TYPE_FOR_JAVA (type)
- && IS_AGGR_TYPE (type))
+ && MAYBE_CLASS_TYPE_P (type))
{
error ("parameter %qD has Java class type", decl);
type = error_mark_node;
@@ -9831,10 +9831,11 @@ grok_op_properties (tree decl, bool complain)
if (arg == error_mark_node)
return false;
- /* IS_AGGR_TYPE, rather than CLASS_TYPE_P, is used
+ /* MAYBE_CLASS_TYPE_P, 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)
+ if (MAYBE_CLASS_TYPE_P (arg)
+ || TREE_CODE (arg) == ENUMERAL_TYPE)
break;
}
@@ -9875,7 +9876,7 @@ grok_op_properties (tree decl, bool complain)
if (t == class_type)
what = "the same type";
/* Don't force t to be complete here. */
- else if (IS_AGGR_TYPE (t)
+ else if (MAYBE_CLASS_TYPE_P (t)
&& COMPLETE_TYPE_P (t)
&& DERIVED_FROM_P (t, class_type))
what = "a base class";
@@ -10349,14 +10350,14 @@ xref_tag (enum tag_types tag_code, tree name,
}
else
{
- t = make_aggr_type (code);
+ t = make_class_type (code);
TYPE_CONTEXT (t) = context;
t = pushtag (name, t, scope);
}
}
else
{
- if (template_header_p && IS_AGGR_TYPE (t))
+ 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);
@@ -10983,7 +10984,7 @@ check_function_type (tree decl, tree current_function_parms)
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)))
+ || (TYPE_FOR_JAVA (return_type) && MAYBE_CLASS_TYPE_P (return_type)))
{
tree args = TYPE_ARG_TYPES (fntype);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index d7e3d76..367d9eb 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -308,7 +308,7 @@ grok_array_decl (tree array_expr, tree index_exp)
type = non_reference (type);
/* If they have an `operator[]', use that. */
- if (IS_AGGR_TYPE (type) || IS_AGGR_TYPE (TREE_TYPE (index_exp)))
+ 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);
@@ -443,7 +443,7 @@ check_member_template (tree tmpl)
if (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == TYPE_DECL
- && IS_AGGR_TYPE (TREE_TYPE (decl))))
+ && MAYBE_CLASS_TYPE_P (TREE_TYPE (decl))))
{
/* The parser rejects template declarations in local classes. */
gcc_assert (!current_function_decl);
@@ -2029,7 +2029,7 @@ constrain_class_visibility (tree type)
%qT has a field %qD whose type uses the anonymous namespace",
type, t);
}
- else if (IS_AGGR_TYPE (ftype)
+ else if (MAYBE_CLASS_TYPE_P (ftype)
&& vis < VISIBILITY_HIDDEN
&& subvis >= VISIBILITY_HIDDEN)
warning (OPT_Wattributes, "\
diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c
index a0f03e8..5ca10fc 100644
--- a/gcc/cp/dump.c
+++ b/gcc/cp/dump.c
@@ -1,5 +1,5 @@
/* Tree-dumping functionality for intermediate representation.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>
@@ -257,7 +257,7 @@ cp_dump_tree (void* dump_info, tree t)
return true;
}
- if (! IS_AGGR_TYPE (t))
+ if (! MAYBE_CLASS_TYPE_P (t))
break;
dump_child ("vfld", TYPE_VFIELD (t));
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index c4dfcc5..a4c5e39 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -1,6 +1,6 @@
/* Help friends in C++.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2007 Free Software Foundation, Inc.
+ 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -227,7 +227,7 @@ make_friend_class (tree type, tree friend_type, bool complain)
int class_template_depth = template_class_depth (type);
int friend_depth = processing_template_decl - class_template_depth;
- if (! IS_AGGR_TYPE (friend_type))
+ if (! MAYBE_CLASS_TYPE_P (friend_type))
{
error ("invalid type %qT declared %<friend%>", friend_type);
return;
@@ -408,7 +408,7 @@ do_friend (tree ctype, tree declarator, tree decl,
bool funcdef_flag)
{
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
- gcc_assert (!ctype || IS_AGGR_TYPE (ctype));
+ gcc_assert (!ctype || MAYBE_CLASS_TYPE_P (ctype));
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3e6db24..e0700ea 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1420,19 +1420,19 @@ expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags)
expand_default_init (binfo, true_exp, exp, init, flags);
}
-/* Report an error if TYPE is not a user-defined, aggregate type. If
+/* Report an error if TYPE is not a user-defined, class type. If
OR_ELSE is nonzero, give an error message. */
int
-is_aggr_type (tree type, int or_else)
+is_class_type (tree type, int or_else)
{
if (type == error_mark_node)
return 0;
- if (! IS_AGGR_TYPE (type))
+ if (! CLASS_TYPE_P (type))
{
if (or_else)
- error ("%qT is not an aggregate type", type);
+ error ("%qT is not a class type", type);
return 0;
}
return 1;
@@ -1476,7 +1476,7 @@ build_offset_ref (tree type, tree member, bool address_p)
/*template_p=*/false);
gcc_assert (TYPE_P (type));
- if (! is_aggr_type (type, 1))
+ if (! is_class_type (type, 1))
return error_mark_node;
gcc_assert (DECL_P (member) || BASELINK_P (member));
@@ -1921,7 +1921,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
(alloc_fn,
build_tree_list (NULL_TREE, class_addr)));
}
- else if (TYPE_FOR_JAVA (elt_type) && IS_AGGR_TYPE (elt_type))
+ 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;
@@ -2456,7 +2456,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
/* 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))
+ if (! MAYBE_CLASS_TYPE_P (type) || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
goto no_destructor;
/* The below is short by the cookie size. */
@@ -2736,7 +2736,7 @@ build_vec_init (tree base, tree maxindex, tree init,
num_initialized_elts++;
current_stmt_tree ()->stmts_are_full_exprs_p = 1;
- if (IS_AGGR_TYPE (type) || TREE_CODE (type) == ARRAY_TYPE)
+ 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,
@@ -2967,7 +2967,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
complete_p = false;
}
}
- if (VOID_TYPE_P (type) || !complete_p || !IS_AGGR_TYPE (type))
+ 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))
@@ -3000,7 +3000,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
addr = convert_force (build_pointer_type (type), addr, 0);
}
- gcc_assert (IS_AGGR_TYPE (type));
+ gcc_assert (MAYBE_CLASS_TYPE_P (type));
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
{
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 06c0bc2..adf793b 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -801,7 +801,7 @@ cxx_make_type (enum tree_code code)
tree t = make_node (code);
/* Create lang_type structure. */
- if (IS_AGGR_TYPE_CODE (code)
+ if (RECORD_OR_UNION_CODE_P (code)
|| code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
struct lang_type *pi = GGC_CNEW (struct lang_type);
@@ -816,7 +816,7 @@ cxx_make_type (enum tree_code code)
}
/* Set up some flags that give proper default behavior. */
- if (IS_AGGR_TYPE_CODE (code))
+ if (RECORD_OR_UNION_CODE_P (code))
{
struct c_fileinfo *finfo = get_fileinfo (input_filename);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
@@ -827,13 +827,10 @@ cxx_make_type (enum tree_code code)
}
tree
-make_aggr_type (enum tree_code code)
+make_class_type (enum tree_code code)
{
tree t = cxx_make_type (code);
-
- if (IS_AGGR_TYPE_CODE (code))
- SET_IS_AGGR_TYPE (t, 1);
-
+ SET_CLASS_TYPE_P (t, 1);
return t;
}
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 3ef73fb..c8061bb 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1,7 +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
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
@@ -507,7 +507,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
t = build3 (COND_EXPR, TREE_TYPE (t), cond, t,
cp_convert (TREE_TYPE (t), integer_zero_node));
}
- if (IS_AGGR_TYPE (TREE_TYPE (t)))
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (t)))
t = build_cplus_new (TREE_TYPE (t), t);
finish_return_stmt (t);
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 9a95d15..75bc6bd 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1737,7 +1737,7 @@ constructor_name_p (tree name, tree type)
{
tree ctor_name;
- gcc_assert (IS_AGGR_TYPE (type));
+ gcc_assert (MAYBE_CLASS_TYPE_P (type));
if (!name)
return false;
@@ -1916,7 +1916,7 @@ push_overloaded_decl (tree decl, int flags, bool is_friend)
if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
{
tree t = TREE_TYPE (old);
- if (IS_AGGR_TYPE (t) && warn_shadow
+ 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);
@@ -2826,7 +2826,7 @@ do_class_using_decl (tree scope, tree name)
error ("%<%T::%D%> names destructor", scope, name);
return NULL_TREE;
}
- if (IS_AGGR_TYPE (scope) && constructor_name_p (name, scope))
+ if (MAYBE_CLASS_TYPE_P (scope) && constructor_name_p (name, scope))
{
error ("%<%T::%D%> names constructor", scope, name);
return NULL_TREE;
@@ -3765,7 +3765,7 @@ lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain)
if (qualified_lookup_using_namespace (name, scope, &binding, flags))
t = binding.value;
}
- else if (is_aggr_type (scope, complain))
+ else if (is_class_type (scope, complain))
t = lookup_member (scope, name, 2, is_type_p);
if (!t)
@@ -4826,7 +4826,8 @@ maybe_process_template_type_declaration (tree type, int is_friend,
;
else
{
- gcc_assert (IS_AGGR_TYPE (type) || TREE_CODE (type) == ENUMERAL_TYPE);
+ gcc_assert (MAYBE_CLASS_TYPE_P (type)
+ || TREE_CODE (type) == ENUMERAL_TYPE);
if (processing_template_decl)
{
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3ffac73..8156822 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14224,7 +14224,7 @@ cp_parser_class_name (cp_parser *parser,
}
else if (TREE_CODE (decl) != TYPE_DECL
|| TREE_TYPE (decl) == error_mark_node
- || !IS_AGGR_TYPE (TREE_TYPE (decl)))
+ || !MAYBE_CLASS_TYPE_P (TREE_TYPE (decl)))
decl = error_mark_node;
if (decl == error_mark_node)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d03ea9f..628a445 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -238,7 +238,7 @@ finish_member_template_decl (tree decl)
type = TREE_TYPE (decl);
if (type == error_mark_node)
return error_mark_node;
- if (IS_AGGR_TYPE (type)
+ if (MAYBE_CLASS_TYPE_P (type)
&& CLASSTYPE_TEMPLATE_INFO (type)
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION (type))
{
@@ -3041,7 +3041,7 @@ process_template_parm (tree list, tree parm, bool is_non_type,
if (parm && TREE_CODE (parm) == TEMPLATE_DECL)
{
- t = make_aggr_type (TEMPLATE_TEMPLATE_PARM);
+ t = cxx_make_type (TEMPLATE_TEMPLATE_PARM);
/* This is for distinguishing between real templates and template
template parameters */
TREE_TYPE (parm) = t;
@@ -3050,7 +3050,7 @@ process_template_parm (tree list, tree parm, bool is_non_type,
}
else
{
- t = make_aggr_type (TEMPLATE_TYPE_PARM);
+ t = cxx_make_type (TEMPLATE_TYPE_PARM);
/* parm is either IDENTIFIER_NODE or NULL_TREE. */
decl = build_decl (TYPE_DECL, parm, t);
}
@@ -5473,7 +5473,7 @@ lookup_template_class (tree d1,
if (template)
context = DECL_CONTEXT (template);
}
- else if (TREE_CODE (d1) == TYPE_DECL && IS_AGGR_TYPE (TREE_TYPE (d1)))
+ else if (TREE_CODE (d1) == TYPE_DECL && MAYBE_CLASS_TYPE_P (TREE_TYPE (d1)))
{
tree type = TREE_TYPE (d1);
@@ -5489,7 +5489,7 @@ lookup_template_class (tree d1,
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
- || (TYPE_P (d1) && IS_AGGR_TYPE (d1)))
+ || (TYPE_P (d1) && MAYBE_CLASS_TYPE_P (d1)))
{
template = TYPE_TI_TEMPLATE (d1);
d1 = DECL_NAME (template);
@@ -5762,7 +5762,7 @@ lookup_template_class (tree d1,
}
else
{
- t = make_aggr_type (TREE_CODE (template_type));
+ t = make_class_type (TREE_CODE (template_type));
CLASSTYPE_DECLARED_CLASS (t)
= CLASSTYPE_DECLARED_CLASS (template_type);
SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t);
@@ -8673,7 +8673,7 @@ tsubst_function_type (tree t,
else
{
tree r = TREE_TYPE (TREE_VALUE (arg_types));
- if (! IS_AGGR_TYPE (r))
+ if (! MAYBE_CLASS_TYPE_P (r))
{
/* [temp.deduct]
@@ -9202,7 +9202,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case OFFSET_TYPE:
{
r = tsubst (TYPE_OFFSET_BASETYPE (t), args, complain, in_decl);
- if (r == error_mark_node || !IS_AGGR_TYPE (r))
+ if (r == error_mark_node || !MAYBE_CLASS_TYPE_P (r))
{
/* [temp.deduct]
@@ -9345,7 +9345,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (ctx == error_mark_node || f == error_mark_node)
return error_mark_node;
- if (!IS_AGGR_TYPE (ctx))
+ if (!MAYBE_CLASS_TYPE_P (ctx))
{
if (complain & tf_error)
error ("%qT is not a class, struct, or union type", ctx);
@@ -11211,7 +11211,7 @@ tsubst_copy_and_build (tree t,
/* 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));
+ process_index_p = !(type && MAYBE_CLASS_TYPE_P (type));
n = VEC_copy (constructor_elt, gc, CONSTRUCTOR_ELTS (t));
newlen = VEC_length (constructor_elt, n);
@@ -12325,7 +12325,7 @@ get_template_base (tree tparms, tree targs, tree parm, tree arg)
tree rval = NULL_TREE;
tree binfo;
- gcc_assert (IS_AGGR_TYPE_CODE (TREE_CODE (arg)));
+ gcc_assert (RECORD_OR_UNION_CODE_P (TREE_CODE (arg)));
binfo = TYPE_BINFO (complete_type (arg));
if (!binfo)
@@ -14317,7 +14317,7 @@ bt_instantiate_type_proc (binding_entry entry, void *data)
{
tree storage = *(tree *) data;
- if (IS_AGGR_TYPE (entry->type)
+ 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);
}
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index f2085e4..8bd51c8 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -503,7 +503,7 @@ build_dynamic_cast_1 (tree type, tree expr)
break;
/* Fall through. */
case REFERENCE_TYPE:
- if (! IS_AGGR_TYPE (TREE_TYPE (type)))
+ if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (type)))
{
errstr = "target is not pointer or reference to class";
goto fail;
@@ -530,7 +530,7 @@ build_dynamic_cast_1 (tree type, tree expr)
errstr = "source is not a pointer";
goto fail;
}
- if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
+ if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype)))
{
errstr = "source is not a pointer to class";
goto fail;
@@ -548,7 +548,7 @@ build_dynamic_cast_1 (tree type, tree expr)
/* 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)))
+ if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype)))
{
errstr = "source is not of class type";
goto fail;
@@ -1167,7 +1167,7 @@ create_pseudo_type_info (int tk, const char *real_name, ...)
}
/* Create the pseudo type. */
- pseudo_type = make_aggr_type (RECORD_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;
@@ -1326,7 +1326,7 @@ create_tinfo_types (void)
fields = field;
ti = VEC_index (tinfo_s, tinfo_descs, TK_TYPE_INFO_TYPE);
- ti->type = make_aggr_type (RECORD_TYPE);
+ ti->type = make_class_type (RECORD_TYPE);
ti->vtable = NULL_TREE;
ti->name = NULL_TREE;
finish_builtin_struct (ti->type, "__type_info_pseudo",
@@ -1364,7 +1364,7 @@ create_tinfo_types (void)
ti = VEC_index (tinfo_s, tinfo_descs, TK_BASE_TYPE);
- ti->type = make_aggr_type (RECORD_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",
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 13e252e..cee2924 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1,7 +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 Free Software Foundation, Inc.
+ 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.
@@ -1212,7 +1213,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type)
}
else
{
- if (!IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
+ if (!RECORD_OR_UNION_CODE_P (TREE_CODE (xbasetype)))
return NULL_TREE;
type = xbasetype;
xbasetype = NULL_TREE;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d17a22e..74d9ae5 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2254,9 +2254,9 @@ begin_class_definition (tree t, tree attributes)
t = error_mark_node;
}
- if (t == error_mark_node || ! IS_AGGR_TYPE (t))
+ if (t == error_mark_node || ! MAYBE_CLASS_TYPE_P (t))
{
- t = make_aggr_type (RECORD_TYPE);
+ t = make_class_type (RECORD_TYPE);
pushtag (make_anon_name (), t, /*tag_scope=*/ts_current);
}
@@ -2265,7 +2265,7 @@ begin_class_definition (tree t, tree attributes)
if (TYPE_BEING_DEFINED (t))
{
- t = make_aggr_type (TREE_CODE (t));
+ t = make_class_type (TREE_CODE (t));
pushtag (TYPE_IDENTIFIER (t), t, /*tag_scope=*/ts_current);
}
maybe_process_partial_specialization (t);
@@ -2469,8 +2469,11 @@ finish_base_specifier (tree base, tree access, bool virtual_p)
error ("invalid base-class specification");
result = NULL_TREE;
}
- else if (! is_aggr_type (base, 1))
- 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)
@@ -2988,7 +2991,7 @@ finish_typeof (tree expr)
if (type_dependent_expression_p (expr))
{
- type = make_aggr_type (TYPEOF_TYPE);
+ type = cxx_make_type (TYPEOF_TYPE);
TYPEOF_TYPE_EXPR (type) = expr;
SET_TYPE_STRUCTURAL_EQUALITY (type);
@@ -4030,7 +4033,7 @@ cxx_omp_predetermined_sharing (tree decl)
if (TREE_STATIC (decl))
{
tree ctx = CP_DECL_CONTEXT (decl);
- if (TYPE_P (ctx) && IS_AGGR_TYPE (ctx))
+ if (TYPE_P (ctx) && MAYBE_CLASS_TYPE_P (ctx))
return OMP_CLAUSE_DEFAULT_SHARED;
}
@@ -4123,7 +4126,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p)
if (type_dependent_expression_p (expr))
{
- type = make_aggr_type (DECLTYPE_TYPE);
+ 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;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 44a2e78..927b3de 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1238,7 +1238,7 @@ bind_template_template_parm (tree t, tree newargs)
tree decl = TYPE_NAME (t);
tree t2;
- t2 = make_aggr_type (BOUND_TEMPLATE_TEMPLATE_PARM);
+ 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
@@ -1958,7 +1958,7 @@ error_type (tree arg)
;
else if (real_lvalue_p (arg))
type = build_reference_type (lvalue_type (arg));
- else if (IS_AGGR_TYPE (type))
+ else if (MAYBE_CLASS_TYPE_P (type))
type = lvalue_type (arg);
return type;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index fa4c3ad..036f93e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1,6 +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
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
@@ -4630,7 +4630,7 @@ unary_complex_lvalue (enum tree_code code, tree arg)
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 (targ) == CALL_EXPR && MAYBE_CLASS_TYPE_P (TREE_TYPE (targ)))
{
if (TREE_CODE (arg) == SAVE_EXPR)
targ = arg;
@@ -5751,7 +5751,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
TREE_SIDE_EFFECTS (result) = 1;
return result;
}
- else if (! IS_AGGR_TYPE (lhstype))
+ else if (! MAYBE_CLASS_TYPE_P (lhstype))
/* Do the default thing. */;
else
{
@@ -5772,7 +5772,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
if (modifycode == NOP_EXPR)
{
/* `operator=' is not an inheritable operator. */
- if (! IS_AGGR_TYPE (lhstype))
+ if (! MAYBE_CLASS_TYPE_P (lhstype))
/* Do the default thing. */;
else
{
@@ -5790,8 +5790,10 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
/* 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)));
- 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)
@@ -6512,7 +6514,7 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
type = complete_type (type);
- if (IS_AGGR_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);
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 66c35d4..c48a785 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1,7 +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
+ 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
@@ -583,7 +583,7 @@ store_init_value (tree decl, tree init)
if (TREE_CODE (type) == ERROR_MARK)
return NULL_TREE;
- if (IS_AGGR_TYPE (type))
+ if (MAYBE_CLASS_TYPE_P (type))
{
gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type)
|| TREE_CODE (init) == CONSTRUCTOR);
@@ -848,7 +848,7 @@ process_init_constructor_array (tree type, tree init)
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)))
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (type)))
next = build_functional_cast (TREE_TYPE (type), NULL_TREE);
else
next = build_constructor (NULL_TREE, NULL);
@@ -935,7 +935,7 @@ process_init_constructor_record (tree type, tree init)
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)))
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (field)))
next = build_functional_cast (TREE_TYPE (field), NULL_TREE);
else
next = build_constructor (NULL_TREE, NULL);
@@ -1161,7 +1161,7 @@ build_x_arrow (tree expr)
expr = build_non_dependent_expr (expr);
}
- if (IS_AGGR_TYPE (type))
+ if (MAYBE_CLASS_TYPE_P (type))
{
while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr,
NULL_TREE, NULL_TREE,
@@ -1240,7 +1240,7 @@ build_m_component_ref (tree datum, tree component)
}
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
- if (! IS_AGGR_TYPE (objtype))
+ if (! MAYBE_CLASS_TYPE_P (objtype))
{
error ("cannot apply member pointer %qE to %qE, which is of "
"non-class type %qT",
@@ -1330,7 +1330,7 @@ build_functional_cast (tree exp, tree parms)
return t;
}
- if (! IS_AGGR_TYPE (type))
+ if (! MAYBE_CLASS_TYPE_P (type))
{
if (parms == NULL_TREE)
return cp_convert (type, integer_zero_node);