mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-12 13:23:47 +08:00
call.c (build_scoped_method_call): Use convert_to_void.
* call.c (build_scoped_method_call): Use convert_to_void. (build_method_call): Likewise. * class.c (check_field_decls): Remove dead code. * cvt.c (convert_from_reference): Remove OFFSET_TYPE handling. * decl2.c (grok_array_decl): Remove dead code. (arg_assoc_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE as pointer-to-member representation. * init.c (build_offset_ref): Tidy. (build_vec_delete_1): Use convert_to_void. * mangle.c (write_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE as pointer-to-member representation. From-SVN: r68895
This commit is contained in:
parent
ee41cff421
commit
8d245821a2
@ -1,3 +1,17 @@
|
||||
2003-07-03 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* call.c (build_scoped_method_call): Use convert_to_void.
|
||||
(build_method_call): Likewise.
|
||||
* class.c (check_field_decls): Remove dead code.
|
||||
* cvt.c (convert_from_reference): Remove OFFSET_TYPE handling.
|
||||
* decl2.c (grok_array_decl): Remove dead code.
|
||||
(arg_assoc_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE
|
||||
as pointer-to-member representation.
|
||||
* init.c (build_offset_ref): Tidy.
|
||||
(build_vec_delete_1): Use convert_to_void.
|
||||
* mangle.c (write_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE
|
||||
as pointer-to-member representation.
|
||||
|
||||
2003-07-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/9162
|
||||
|
@ -263,7 +263,7 @@ build_scoped_method_call (tree exp, tree basetype, tree name, tree parms)
|
||||
error ("type of `%E' does not match destructor type `%T' (type was `%T')",
|
||||
exp, basetype, type);
|
||||
|
||||
return cp_convert (void_type_node, exp);
|
||||
return convert_to_void (exp, /*implicit=*/NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ build_scoped_method_call (tree exp, tree basetype, tree name, tree parms)
|
||||
if (TREE_CODE (name) == BIT_NOT_EXPR)
|
||||
{
|
||||
if (! TYPE_HAS_DESTRUCTOR (TREE_TYPE (decl)))
|
||||
return cp_convert (void_type_node, exp);
|
||||
return convert_to_void (exp, /*implicit=*/NULL);
|
||||
|
||||
return build_delete (TREE_TYPE (decl), decl,
|
||||
sfk_complete_destructor,
|
||||
@ -496,7 +496,7 @@ build_method_call (tree instance, tree name, tree parms,
|
||||
TREE_OPERAND (name, 0), object_type);
|
||||
|
||||
if (! TYPE_HAS_DESTRUCTOR (complete_type (object_type)))
|
||||
return cp_convert (void_type_node, instance);
|
||||
return convert_to_void (instance, /*implicit=*/NULL);
|
||||
instance = default_conversion (instance);
|
||||
instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
|
||||
return build_delete (build_pointer_type (object_type),
|
||||
|
@ -3091,12 +3091,6 @@ check_field_decls (tree t, tree *access_decls,
|
||||
type = build_pointer_type (type);
|
||||
TREE_TYPE (x) = type;
|
||||
}
|
||||
else if (TREE_CODE (type) == OFFSET_TYPE)
|
||||
{
|
||||
cp_error_at ("field `%D' invalidly declared offset type", x);
|
||||
type = build_pointer_type (type);
|
||||
TREE_TYPE (x) = type;
|
||||
}
|
||||
|
||||
if (type == error_mark_node)
|
||||
continue;
|
||||
|
@ -552,11 +552,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
|
||||
tree
|
||||
convert_from_reference (tree val)
|
||||
{
|
||||
tree type = TREE_TYPE (val);
|
||||
|
||||
if (TREE_CODE (type) == OFFSET_TYPE)
|
||||
type = TREE_TYPE (type);
|
||||
if (TREE_CODE (type) == REFERENCE_TYPE)
|
||||
if (TREE_CODE (TREE_TYPE (val)) == REFERENCE_TYPE)
|
||||
return build_indirect_ref (val, NULL);
|
||||
return val;
|
||||
}
|
||||
|
@ -407,16 +407,9 @@ grok_array_decl (tree array_expr, tree index_exp)
|
||||
return build_min (ARRAY_REF, type ? TREE_TYPE (type) : NULL_TREE,
|
||||
array_expr, index_exp);
|
||||
|
||||
if (type == NULL_TREE)
|
||||
{
|
||||
/* Something has gone very wrong. Assume we are mistakenly reducing
|
||||
an expression instead of a declaration. */
|
||||
error ("parser may be lost: is there a '{' missing somewhere?");
|
||||
return NULL_TREE;
|
||||
}
|
||||
my_friendly_assert (type, 20030626);
|
||||
|
||||
if (TREE_CODE (type) == OFFSET_TYPE
|
||||
|| TREE_CODE (type) == REFERENCE_TYPE)
|
||||
if (TREE_CODE (type) == REFERENCE_TYPE)
|
||||
type = TREE_TYPE (type);
|
||||
|
||||
/* If they have an `operator[]', use that. */
|
||||
@ -4069,8 +4062,15 @@ arg_assoc_type (struct arg_lookup *k, tree type)
|
||||
right, we can end up with such things without a type. */
|
||||
if (!type)
|
||||
return false;
|
||||
|
||||
switch (TREE_CODE (type))
|
||||
|
||||
if (TYPE_PTRMEM_P (type))
|
||||
{
|
||||
/* Pointer to member: associate class type and value type. */
|
||||
if (arg_assoc_type (k, TYPE_PTRMEM_CLASS_TYPE (type)))
|
||||
return true;
|
||||
return arg_assoc_type (k, TYPE_PTRMEM_POINTED_TO_TYPE (type));
|
||||
}
|
||||
else switch (TREE_CODE (type))
|
||||
{
|
||||
case ERROR_MARK:
|
||||
return false;
|
||||
@ -4093,11 +4093,6 @@ arg_assoc_type (struct arg_lookup *k, tree type)
|
||||
case UNION_TYPE:
|
||||
case ENUMERAL_TYPE:
|
||||
return arg_assoc_namespace (k, decl_namespace (TYPE_MAIN_DECL (type)));
|
||||
case OFFSET_TYPE:
|
||||
/* Pointer to member: associate class type and value type. */
|
||||
if (arg_assoc_type (k, TYPE_OFFSET_BASETYPE (type)))
|
||||
return true;
|
||||
return arg_assoc_type (k, TREE_TYPE (type));
|
||||
case METHOD_TYPE:
|
||||
/* The basetype is referenced in the first arg type, so just
|
||||
fall through. */
|
||||
|
@ -1501,7 +1501,7 @@ build_member_call (tree type, tree name, tree parmlist)
|
||||
tree
|
||||
build_offset_ref (tree type, tree name)
|
||||
{
|
||||
tree decl, t = error_mark_node;
|
||||
tree decl;
|
||||
tree member;
|
||||
tree basebinfo = NULL_TREE;
|
||||
tree orig_name = name;
|
||||
@ -1546,7 +1546,7 @@ build_offset_ref (tree type, tree name)
|
||||
/* Handle namespace names fully here. */
|
||||
if (TREE_CODE (type) == NAMESPACE_DECL)
|
||||
{
|
||||
t = lookup_namespace_name (type, name);
|
||||
tree t = lookup_namespace_name (type, name);
|
||||
if (t == error_mark_node)
|
||||
return t;
|
||||
if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR)
|
||||
@ -1597,7 +1597,7 @@ build_offset_ref (tree type, tree name)
|
||||
{
|
||||
/* Go from the TREE_BASELINK to the member function info. */
|
||||
tree fnfields = member;
|
||||
t = BASELINK_FUNCTIONS (fnfields);
|
||||
tree t = BASELINK_FUNCTIONS (fnfields);
|
||||
|
||||
if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR)
|
||||
{
|
||||
@ -1644,44 +1644,43 @@ build_offset_ref (tree type, tree name)
|
||||
return t;
|
||||
}
|
||||
|
||||
t = member;
|
||||
|
||||
if (t == NULL_TREE)
|
||||
if (member == NULL_TREE)
|
||||
{
|
||||
error ("`%D' is not a member of type `%T'", name, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (TREE_CODE (t) == TYPE_DECL)
|
||||
if (TREE_CODE (member) == TYPE_DECL)
|
||||
{
|
||||
TREE_USED (t) = 1;
|
||||
return t;
|
||||
TREE_USED (member) = 1;
|
||||
return member;
|
||||
}
|
||||
/* static class members and class-specific enum
|
||||
values can be returned without further ado. */
|
||||
if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == CONST_DECL)
|
||||
if (TREE_CODE (member) == VAR_DECL || TREE_CODE (member) == CONST_DECL)
|
||||
{
|
||||
mark_used (t);
|
||||
return convert_from_reference (t);
|
||||
mark_used (member);
|
||||
return convert_from_reference (member);
|
||||
}
|
||||
|
||||
if (TREE_CODE (t) == FIELD_DECL && DECL_C_BIT_FIELD (t))
|
||||
if (TREE_CODE (member) == FIELD_DECL && DECL_C_BIT_FIELD (member))
|
||||
{
|
||||
error ("invalid pointer to bit-field `%D'", t);
|
||||
error ("invalid pointer to bit-field `%D'", member);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
/* static class functions too. */
|
||||
if (TREE_CODE (t) == FUNCTION_DECL
|
||||
&& TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
|
||||
if (TREE_CODE (member) == FUNCTION_DECL
|
||||
&& TREE_CODE (TREE_TYPE (member)) == FUNCTION_TYPE)
|
||||
abort ();
|
||||
|
||||
/* In member functions, the form `type::name' is no longer
|
||||
equivalent to `this->type::name', at least not until
|
||||
resolve_offset_ref. */
|
||||
t = build (OFFSET_REF, build_offset_type (type, TREE_TYPE (t)), decl, t);
|
||||
PTRMEM_OK_P (t) = 1;
|
||||
return t;
|
||||
member = build (OFFSET_REF, build_offset_type (type, TREE_TYPE (member)),
|
||||
decl, member);
|
||||
PTRMEM_OK_P (member) = 1;
|
||||
return member;
|
||||
}
|
||||
|
||||
/* If a OFFSET_REF made it through to here, then it did
|
||||
@ -2625,7 +2624,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
|
||||
/* Pre-evaluate the SAVE_EXPR outside of the BIND_EXPR. */
|
||||
body = build (COMPOUND_EXPR, void_type_node, base, body);
|
||||
|
||||
return cp_convert (void_type_node, body);
|
||||
return convert_to_void (body, /*implicit=*/NULL);
|
||||
}
|
||||
|
||||
/* Create an unnamed variable of the indicated TYPE. */
|
||||
|
@ -1441,7 +1441,9 @@ write_type (tree type)
|
||||
/* See through any typedefs. */
|
||||
type = TYPE_MAIN_VARIANT (type);
|
||||
|
||||
switch (TREE_CODE (type))
|
||||
if (TYPE_PTRMEM_P (type))
|
||||
write_pointer_to_member_type (type);
|
||||
else switch (TREE_CODE (type))
|
||||
{
|
||||
case VOID_TYPE:
|
||||
case BOOLEAN_TYPE:
|
||||
@ -1483,15 +1485,8 @@ write_type (tree type)
|
||||
break;
|
||||
|
||||
case POINTER_TYPE:
|
||||
/* A pointer-to-member variable is represented by a POINTER_TYPE
|
||||
to an OFFSET_TYPE, so check for this first. */
|
||||
if (TYPE_PTRMEM_P (type))
|
||||
write_pointer_to_member_type (type);
|
||||
else
|
||||
{
|
||||
write_char ('P');
|
||||
write_type (TREE_TYPE (type));
|
||||
}
|
||||
write_char ('P');
|
||||
write_type (TREE_TYPE (type));
|
||||
break;
|
||||
|
||||
case REFERENCE_TYPE:
|
||||
@ -1514,10 +1509,6 @@ write_type (tree type)
|
||||
(TI_ARGS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (type)));
|
||||
break;
|
||||
|
||||
case OFFSET_TYPE:
|
||||
write_pointer_to_member_type (build_pointer_type (type));
|
||||
break;
|
||||
|
||||
case VECTOR_TYPE:
|
||||
write_string ("U8__vector");
|
||||
write_type (TREE_TYPE (type));
|
||||
|
Loading…
Reference in New Issue
Block a user