diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-10-20 22:41:53 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-10-20 22:41:53 +0000 |
commit | 249a82c4c632bbba058b583d41b3829ae7e8f119 (patch) | |
tree | d92f3d904701bebb9ece6405dc79f58c575c78f0 /gcc/objc/objc-act.c | |
parent | f1e344ed754edda1085dfeecca07680119f3a67c (diff) | |
download | gcc-249a82c4c632bbba058b583d41b3829ae7e8f119.zip gcc-249a82c4c632bbba058b583d41b3829ae7e8f119.tar.gz gcc-249a82c4c632bbba058b583d41b3829ae7e8f119.tar.bz2 |
In gcc/: 2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/:
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (c_parser_objc_method_type): Mark inline. Return a
bool instead of a tree.
(c_parser_objc_method_decl): Added bool argument. Updated call to
objc_build_method_signature.
(c_parser_objc_method_definition): Do not call
objc_set_method_type. Updated calls to c_parser_objc_method_type,
c_parser_objc_method_decl and objc_start_method_definition.
(c_parser_objc_methodproto): Do not call objc_set_method_type.
Updated calls to c_parser_objc_method_type,
c_parser_objc_method_decl and objc_add_method_declaration.
In gcc/c-family/:
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
* c-common.h (objc_set_method_type): Removed.
(objc_add_method_declaration): Added boolean argument.
(objc_start_method_definition): Same change.
(objc_build_method_signature): Same change.
* stub-objc.c (objc_set_method_type): Removed.
(objc_add_method_declaration): Added boolean argument.
(objc_start_method_definition): Same change.
(objc_build_method_signature): Same change.
In gcc/cp/:
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (cp_parser_objc_method_type): Mark inline. Return a
bool instead of calling objc_set_method_type.
(cp_parser_objc_method_signature): Updated calls to
cp_parser_objc_method_type and to objc_build_method_signature.
(cp_parser_objc_method_prototype_list): Updated calls to
objc_add_method_declaration. Use token->type to determine if it
is a class method or not.
(cp_parser_objc_method_definition_list): Same change.
In gcc/objc/:
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.h (objc_inherit_code): Removed.
* objc-act.c (objc_inherit_code): Removed.
(objc_set_method_type): Removed.
(objc_build_method_signature): Added is_class_method argument.
Use it instead of the global objc_inherit_code variable.
(objc_add_method_declaration): Same change.
(objc_start_method_definition): Same change.
(objc_generate_cxx_ctor_or_dtor): Updated call to
objc_start_method_definition. Do not call objc_set_method_type.
(adjust_type_for_id_default): Mark as inline.
(objc_synthesize_getter): Updated call to
objc_start_method_definition. Do not set objc_inherit_code.
(objc_synthesize_setter): Updated call to
objc_start_method_definition. Do not set objc_inherit_code.
From-SVN: r165741
Diffstat (limited to 'gcc/objc/objc-act.c')
-rw-r--r-- | gcc/objc/objc-act.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 219b80e..77324a3 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -392,7 +392,6 @@ struct imp_entry *imp_list = 0; int imp_count = 0; /* `@implementation' */ int cat_count = 0; /* `@category' */ -enum tree_code objc_inherit_code; objc_ivar_visibility_kind objc_ivar_visibility; /* Use to generate method labels. */ @@ -1278,24 +1277,20 @@ build_property_reference (tree property, tree id) return getter; } -void -objc_set_method_type (enum tree_code type) -{ - objc_inherit_code = (type == PLUS_EXPR - ? CLASS_METHOD_DECL - : INSTANCE_METHOD_DECL); -} - tree -objc_build_method_signature (tree rettype, tree selector, +objc_build_method_signature (bool is_class_method, tree rettype, tree selector, tree optparms, bool ellipsis) { - return build_method_decl (objc_inherit_code, rettype, selector, - optparms, ellipsis); + if (is_class_method) + return build_method_decl (CLASS_METHOD_DECL, rettype, selector, + optparms, ellipsis); + else + return build_method_decl (INSTANCE_METHOD_DECL, rettype, selector, + optparms, ellipsis); } void -objc_add_method_declaration (tree decl, tree attributes) +objc_add_method_declaration (bool is_class_method, tree decl, tree attributes) { if (!objc_interface_context) { @@ -1309,7 +1304,7 @@ objc_add_method_declaration (tree decl, tree attributes) objc_decl_method_attributes (&decl, attributes, 0); objc_add_method (objc_interface_context, decl, - objc_inherit_code == CLASS_METHOD_DECL, + is_class_method, objc_method_optional_flag); } @@ -1317,7 +1312,7 @@ objc_add_method_declaration (tree decl, tree attributes) 'false' if not (because we are outside an @implementation context). */ bool -objc_start_method_definition (tree decl, tree attributes) +objc_start_method_definition (bool is_class_method, tree decl, tree attributes) { if (!objc_implementation_context) { @@ -1338,7 +1333,7 @@ objc_start_method_definition (tree decl, tree attributes) objc_decl_method_attributes (&decl, attributes, 0); objc_add_method (objc_implementation_context, decl, - objc_inherit_code == CLASS_METHOD_DECL, + is_class_method, /* is optional */ false); start_method_def (decl); return true; @@ -5179,17 +5174,18 @@ objc_generate_cxx_ctor_or_dtor (bool dtor) /* - (id) .cxx_construct { ... return self; } */ /* - (void) .cxx_construct { ... } */ - objc_set_method_type (MINUS_EXPR); objc_start_method_definition - (objc_build_method_signature (build_tree_list (NULL_TREE, - dtor - ? void_type_node - : objc_object_type), - get_identifier (dtor - ? TAG_CXX_DESTRUCT - : TAG_CXX_CONSTRUCT), - make_node (TREE_LIST), - false), NULL); + (false /* is_class_method */, + objc_build_method_signature (false /* is_class_method */, + build_tree_list (NULL_TREE, + dtor + ? void_type_node + : objc_object_type), + get_identifier (dtor + ? TAG_CXX_DESTRUCT + : TAG_CXX_CONSTRUCT), + make_node (TREE_LIST), + false), NULL); body = begin_function_body (); compound_stmt = begin_compound_stmt (0); @@ -6498,8 +6494,7 @@ synth_id_with_class_suffix (const char *preamble, tree ctxt) /* If type is empty or only type qualifiers are present, add default type of id (otherwise grokdeclarator will default to int). */ - -static tree +static inline tree adjust_type_for_id_default (tree type) { if (!type) @@ -6557,7 +6552,6 @@ objc_build_keyword_decl (tree key_name, tree arg_type, } /* Given a chain of keyword_decl's, synthesize the full keyword selector. */ - static tree build_keyword_selector (tree selector) { @@ -8660,9 +8654,8 @@ objc_synthesize_getter (tree klass, tree class_method, tree property) if (!decl) return; - objc_inherit_code = INSTANCE_METHOD_DECL; /* For now no attributes. */ - objc_start_method_definition (copy_node (decl), NULL_TREE); + objc_start_method_definition (false /* is_class_method */, copy_node (decl), NULL_TREE); body = c_begin_compound_stmt (true); /* return self->_property_name; */ @@ -8720,9 +8713,8 @@ objc_synthesize_setter (tree klass, tree class_method, tree property) if (!decl) return; - objc_inherit_code = INSTANCE_METHOD_DECL; /* For now, no attributes. */ - objc_start_method_definition (copy_node (decl), NULL_TREE); + objc_start_method_definition (false /* is_class_method */, copy_node (decl), NULL_TREE); body = c_begin_compound_stmt (true); /* _property_name = _value; */ |