diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2011-05-06 01:37:00 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2011-05-06 01:37:00 +0000 |
commit | 6174da1b28176c4879ec55581325b4648fc72096 (patch) | |
tree | 06eefaee175f6f613c49a5e5b8325691f5b90bdc /gcc/objc/objc-act.c | |
parent | 9eb21cfca6bdbc70fe9deab875a93a8217a20434 (diff) | |
download | gcc-6174da1b28176c4879ec55581325b4648fc72096.zip gcc-6174da1b28176c4879ec55581325b4648fc72096.tar.gz gcc-6174da1b28176c4879ec55581325b4648fc72096.tar.bz2 |
don't use build_function_type in the ObjC/C++ frontends
don't use build_function_type in the ObjC/C++ frontends
* objc-runtime-shared-support.h (get_arg_type_list): Delete.
(build_function_type_for_method): Declare.
* objc-runtime-hooks.h (struct _objc_runtime_hooks_r): Change
type of get_arg_type_base_list field.
* objc-act.h (OBJC_VOID_AT_END): Delete.
* objc-act.c (get_arg_type_list): Delete.
(build_function_type_for_method): New function.
(objc_decl_method_attributes): Call build_function_type_for_method.
(really_start_method): Likewise.
* objc-gnu-runtime-abi-01.c
(gnu_runtime_abi_01_get_type_arg_list_base): Change prototype and
adjust function accordingly. Update header comment.
(build_objc_method_call): Call build_function_type_for_method.
* objc-next-runtime-abi-01.c
(next_runtime_abi_01_get_type_arg_list_base): Change prototype and
adjust function accordingly. Update header comment.
(build_objc_method_call): Call build_function_type_for_method.
* objc-next-runtime-abi-02.c
(next_runtime_abi_02_get_type_arg_list_base): Change prototype and
adjust function accordingly. Update header comment.
(objc_copy_to_temp_side_effect_params): Take fntype instead of a
typelist. Use function_args_iterator for traversing fntype.
(build_v2_build_objc_method_call): Adjust call to it.
Call build_function_type_for_method
From-SVN: r173465
Diffstat (limited to 'gcc/objc/objc-act.c')
-rw-r--r-- | gcc/objc/objc-act.c | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 46cfc55..7e69b0d 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -5043,8 +5043,9 @@ objc_decl_method_attributes (tree *node, tree attributes, int flags) (by setting TREE_DEPRECATED and TREE_THIS_VOLATILE) so there is nothing to do. */ tree saved_type = TREE_TYPE (*node); - TREE_TYPE (*node) = build_function_type - (TREE_VALUE (saved_type), get_arg_type_list (*node, METHOD_REF, 0)); + TREE_TYPE (*node) + = build_function_type_for_method (TREE_VALUE (saved_type), *node, + METHOD_REF, 0); decl_attributes (node, filtered_attributes, flags); METHOD_TYPE_ATTRIBUTES (*node) = TYPE_ATTRIBUTES (TREE_TYPE (*node)); TREE_TYPE (*node) = saved_type; @@ -5057,60 +5058,66 @@ objc_method_decl (enum tree_code opcode) return opcode == INSTANCE_METHOD_DECL || opcode == CLASS_METHOD_DECL; } -/* Used by `build_objc_method_call'. Return an argument list for - method METH. CONTEXT is either METHOD_DEF or METHOD_REF, saying - whether we are trying to define a method or call one. SUPERFLAG - says this is for a send to super; this makes a difference for the - NeXT calling sequence in which the lookup and the method call are - done together. If METH is null, user-defined arguments (i.e., - beyond self and _cmd) shall be represented by `...'. */ +/* Return a function type for METHOD with RETURN_TYPE. CONTEXT is + either METHOD_DEF or METHOD_REF, indicating whether we are defining a + method or calling one. SUPER_FLAG indicates whether this is a send + to super; this makes a difference for the NeXT calling sequence in + which the lookup and the method call are done together. If METHOD is + NULL, user-defined arguments (i.e., beyond self and _cmd) shall be + represented as varargs. */ tree -get_arg_type_list (tree meth, int context, int superflag) +build_function_type_for_method (tree return_type, tree method, + int context, bool super_flag) { - tree arglist, akey; + VEC(tree,gc) *argtypes = make_tree_vector (); + tree t, ftype; + bool is_varargs = false; - /* Receiver & _cmd types are runtime-dependent. */ - arglist = (*runtime.get_arg_type_list_base) (meth, context, superflag); + (*runtime.get_arg_type_list_base) (&argtypes, method, context, super_flag); - /* No actual method prototype given -- assume that remaining arguments - are `...'. */ - if (!meth) - return arglist; + /* No actual method prototype given; remaining args passed as varargs. */ + if (method == NULL_TREE) + { + is_varargs = true; + goto build_ftype; + } - /* Build a list of argument types. */ - for (akey = METHOD_SEL_ARGS (meth); akey; akey = DECL_CHAIN (akey)) + for (t = METHOD_SEL_ARGS (method); t; t = DECL_CHAIN (t)) { - tree arg_type = TREE_VALUE (TREE_TYPE (akey)); + tree arg_type = TREE_VALUE (TREE_TYPE (t)); - /* Decay argument types for the underlying C function as appropriate. */ + /* Decay argument types for the underlying C function as + appropriate. */ arg_type = objc_decay_parm_type (arg_type); - chainon (arglist, build_tree_list (NULL_TREE, arg_type)); + VEC_safe_push (tree, gc, argtypes, arg_type); } - if (METHOD_ADD_ARGS (meth)) + if (METHOD_ADD_ARGS (method)) { - for (akey = TREE_CHAIN (METHOD_ADD_ARGS (meth)); - akey; akey = TREE_CHAIN (akey)) + for (t = TREE_CHAIN (METHOD_ADD_ARGS (method)); + t; t = TREE_CHAIN (t)) { - tree arg_type = TREE_TYPE (TREE_VALUE (akey)); + tree arg_type = TREE_TYPE (TREE_VALUE (t)); arg_type = objc_decay_parm_type (arg_type); - chainon (arglist, build_tree_list (NULL_TREE, arg_type)); + VEC_safe_push (tree, gc, argtypes, arg_type); } - if (!METHOD_ADD_ARGS_ELLIPSIS_P (meth)) - goto lack_of_ellipsis; + if (METHOD_ADD_ARGS_ELLIPSIS_P (method)) + is_varargs = true; } + + build_ftype: + if (is_varargs) + ftype = build_varargs_function_type_vec (return_type, argtypes); else - { - lack_of_ellipsis: - chainon (arglist, OBJC_VOID_AT_END); - } + ftype = build_function_type_vec (return_type, argtypes); - return arglist; + release_tree_vector (argtypes); + return ftype; } static tree @@ -8700,9 +8707,7 @@ really_start_method (tree method, push_lang_context (lang_name_c); #endif - meth_type - = build_function_type (ret_type, - get_arg_type_list (method, METHOD_DEF, 0)); + meth_type = build_function_type_for_method (ret_type, method, METHOD_DEF, 0); objc_start_function (method_id, meth_type, NULL_TREE, parmlist); /* Set self_decl from the first argument. */ |