aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-29 16:55:29 +0000
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-29 16:55:29 +0000
commit77b74f121935e68dc2b0b18e07a6645c5ed20a28 (patch)
tree9e652764e0e07fdde33f80e12fd139d7cbf4fdc3
parentd3d16215ffa15c80a5403cfeb13bd832023f0c9e (diff)
type_promotes_to langhook conversion.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype2@220256 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c-family/c-common.h2
-rw-r--r--gcc/c/c-tree.h2
-rw-r--r--gcc/c/c-typeck.c16
-rw-r--r--gcc/cp/call.c18
-rw-r--r--gcc/cp/cp-tree.h6
-rw-r--r--gcc/cp/cvt.c21
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.c2
-rw-r--r--gcc/langhooks.h2
10 files changed, 37 insertions, 36 deletions
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 9d5fba19ddd..897c78bb036 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -855,7 +855,7 @@ extern tree pointer_int_sum (location_t, enum tree_code, tree, tree,
bool = true);
/* Add qualifiers to a type, in the fashion for C. */
-extern tree c_build_qualified_type (tree, int);
+extern ttype *c_build_qualified_type (tree, int);
/* Build tree nodes and builtin functions common to both C and C++ language
frontends. */
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index c879bc77a25..689e5e3b22c 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -584,7 +584,7 @@ extern int comptypes_check_different_types (tree, tree, bool *);
extern bool c_vla_type_p (const_tree);
extern bool c_mark_addressable (tree);
extern void c_incomplete_type_error (const_tree, const_tree);
-extern tree c_type_promotes_to (tree);
+extern ttype *c_type_promotes_to (tree);
extern struct c_expr default_function_array_conversion (location_t,
struct c_expr);
extern struct c_expr default_function_array_read_conversion (location_t,
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index f39dfdd9aae..4bc1670bdf4 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -291,10 +291,10 @@ c_incomplete_type_error (const_tree value, const_tree type)
/* Given a type, apply default promotions wrt unnamed function
arguments and return the new type. */
-tree
+ttype *
c_type_promotes_to (tree type)
{
- tree ret = NULL_TREE;
+ ttype *ret = NULL;
if (TYPE_MAIN_VARIANT (type) == float_type_node)
ret = double_type_node;
@@ -313,7 +313,7 @@ c_type_promotes_to (tree type)
? c_build_qualified_type (ret, TYPE_QUAL_ATOMIC)
: ret);
- return type;
+ return TTYPE (type);
}
/* Return true if between two named address spaces, whether there is a superset
@@ -12539,20 +12539,20 @@ c_finish_transaction (location_t loc, tree block, int flags)
/* Make a variant type in the proper way for C/C++, propagating qualifiers
down to the element type of an array. */
-tree
+ttype *
c_build_qualified_type (tree type, int type_quals)
{
if (type == error_mark_node)
- return type;
+ return error_type_node;
if (TREE_CODE (type) == ARRAY_TYPE)
{
- tree t;
- tree element_type = c_build_qualified_type (TREE_TYPE (type),
+ ttype *t;
+ ttype *element_type = c_build_qualified_type (TREE_TYPE (type),
type_quals);
/* See if we already have an identically qualified type. */
- for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
+ for (t = TTYPE_MAIN_VARIANT (type); t; t = TTYPE_NEXT_VARIANT (t))
{
if (TYPE_QUALS (strip_array_types (t)) == type_quals
&& TYPE_NAME (t) == TYPE_NAME (type)
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c0a1347c448..4ff036f183b 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2773,14 +2773,14 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
(candidates, fnname, type1, type2, args, argtypes, flags, complain);
}
-tree
+ttype *
type_decays_to (tree type)
{
if (TREE_CODE (type) == ARRAY_TYPE)
return build_pointer_type (TREE_TYPE (type));
if (TREE_CODE (type) == FUNCTION_TYPE)
return build_pointer_type (type);
- return type;
+ return TTYPE (type);
}
/* There are three conditions of builtin candidates:
@@ -2915,7 +2915,7 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
vec_safe_push (types[i], type);
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
- type = TTYPE (type_promotes_to (type));
+ type = type_promotes_to (type);
}
if (! vec_member (type, types[i]))
@@ -2933,7 +2933,7 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
if (enum_p && UNSCOPED_ENUM_P (type))
vec_safe_push (types[i], type);
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
- type = TTYPE (type_promotes_to (type));
+ type = type_promotes_to (type);
}
vec_safe_push (types[i], type);
}
@@ -6713,18 +6713,18 @@ build_x_va_arg (source_location loc, tree expr, tree type)
would have happened when passed via ellipsis. Return the promoted
type, or the passed type if there is no change. */
-tree
+ttype *
cxx_type_promotes_to (tree type)
{
- tree promote;
+ ttype *promote;
/* Perform the array-to-pointer and function-to-pointer
conversions. */
- type = type_decays_to (type);
+ promote = type_decays_to (type);
- promote = type_promotes_to (type);
+ promote = type_promotes_to (promote);
if (same_type_p (type, promote))
- promote = type;
+ promote = TTYPE (type);
return promote;
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0b32e0261b6..029d1b359bd 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5188,7 +5188,7 @@ extern tree build_call_n (tree, int, ...);
extern bool null_ptr_cst_p (tree);
extern bool null_member_pointer_value_p (tree);
extern bool sufficient_parms_p (const_tree);
-extern tree type_decays_to (tree);
+extern ttype *type_decays_to (tree);
extern tree build_user_type_conversion (tree, tree, int,
tsubst_flags_t);
extern tree build_new_function_call (tree, vec<tree, va_gc> **, bool,
@@ -5224,7 +5224,7 @@ extern tree convert_default_arg (tree, tree, tree, int,
tsubst_flags_t);
extern tree convert_arg_to_ellipsis (tree, tsubst_flags_t);
extern tree build_x_va_arg (source_location, tree, tree);
-extern tree cxx_type_promotes_to (tree);
+extern ttype *cxx_type_promotes_to (tree);
extern tree type_passed_as (tree);
extern tree convert_for_arg_passing (tree, tree, tsubst_flags_t);
extern bool is_properly_derived_from (tree, tree);
@@ -5344,7 +5344,7 @@ extern tree convert_to_void (tree, impl_conv_void,
extern tree convert_force (tree, tree, int,
tsubst_flags_t);
extern tree build_expr_type_conversion (int, tree, bool);
-extern tree type_promotes_to (tree);
+extern ttype *type_promotes_to (tree);
extern tree perform_qualification_conversions (tree, tree);
/* in name-lookup.c */
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index d0924f100c5..222a27fd4c7 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -1688,18 +1688,19 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
/* Implements integral promotion (4.1) and float->double promotion. */
-tree
-type_promotes_to (tree type)
+ttype *
+type_promotes_to (tree orig_type)
{
- tree promoted_type;
+ ttype *promoted_type;
+ ttype *type;
- if (type == error_mark_node)
- return error_mark_node;
+ if (orig_type == error_mark_node)
+ return error_type_node;
- type = TYPE_MAIN_VARIANT (type);
+ type = TTYPE_MAIN_VARIANT (orig_type);
/* Check for promotions of target-defined types first. */
- promoted_type = targetm.promoted_type (type);
+ promoted_type = TTYPE (targetm.promoted_type (type));
if (promoted_type)
return promoted_type;
@@ -1718,10 +1719,10 @@ type_promotes_to (tree type)
{
int precision = MAX (TYPE_PRECISION (type),
TYPE_PRECISION (integer_type_node));
- tree totype = c_common_type_for_size (precision, 0);
- tree prom = type;
+ ttype *totype = c_common_type_for_size (precision, 0);
+ ttype *prom = type;
if (TREE_CODE (prom) == ENUMERAL_TYPE)
- prom = ENUM_UNDERLYING_TYPE (prom);
+ prom = TTYPE (ENUM_UNDERLYING_TYPE (prom));
if (TYPE_UNSIGNED (prom)
&& ! int_fits_type_p (TYPE_MAX_VALUE (prom), totype))
prom = c_common_type_for_size (precision, 1);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7398ee3f859..c171b84373a 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1007,7 +1007,7 @@ move (tree expr)
/* Used by the C++ front end to build qualified array types. However,
the C version of this function does not properly maintain canonical
types (which are not used in C). */
-tree
+ttype *
c_build_qualified_type (tree type, int type_quals)
{
return cp_build_qualified_type (type, type_quals);
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index adfe8bae6a6..d3688b40729 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -53,7 +53,7 @@ extern void lhd_print_error_function (diagnostic_context *,
extern void lhd_set_decl_assembler_name (tree);
extern bool lhd_warn_unused_global_decl (const_tree);
extern void lhd_incomplete_type_error (const_tree, const_tree);
-extern tree lhd_type_promotes_to (tree);
+extern ttype *lhd_type_promotes_to (tree);
extern void lhd_register_builtin_type (tree, const char *);
extern bool lhd_decl_ok_for_sibcall (const_tree);
extern size_t lhd_tree_size (enum tree_code);
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 63a66427931..8fa0d33bdaa 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -205,7 +205,7 @@ lhd_set_decl_assembler_name (tree decl)
}
/* Type promotion for variable arguments. */
-tree
+ttype *
lhd_type_promotes_to (tree ARG_UNUSED (type))
{
gcc_unreachable ();
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 619cdc6ef5e..4c33b63a38a 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -86,7 +86,7 @@ struct lang_hooks_for_types
arguments and return the new type. Return the same type if no
change. Required by any language that supports variadic
arguments. The default hook dies. */
- tree (*type_promotes_to) (tree);
+ ttype *(*type_promotes_to) (tree);
/* Register TYPE as a builtin type with the indicated NAME. The
TYPE is placed in the outermost lexical scope. The semantics