diff options
| author | Ziemowit Laski <zlaski@apple.com> | 2005-05-17 20:05:24 +0000 |
|---|---|---|
| committer | Mike Stump <mrs@gcc.gnu.org> | 2005-05-17 20:05:24 +0000 |
| commit | e58a9aa1f6d2371b0cfaff671729d4f56c72b28c (patch) | |
| tree | f0a3a7afbe4d1781460908fb5b17aa8fd11f5c47 /gcc/cp/pt.c | |
| parent | b4838d2947d68ae454f83df6ec71e1e03fbb8408 (diff) | |
| download | gcc-e58a9aa1f6d2371b0cfaff671729d4f56c72b28c.zip gcc-e58a9aa1f6d2371b0cfaff671729d4f56c72b28c.tar.gz gcc-e58a9aa1f6d2371b0cfaff671729d4f56c72b28c.tar.bz2 | |
Yet more Objective-C++...
* cp-objcp-common.h (cxx_get_alias_set): Move from
here...
(cxx_warn_unused_global_decl): Likewise.
(cp_expr_size): Likewise.
(cp_tree_size): Likewise.
(cp_var_mod_type_p): Likewise.
(cxx_initialize_diagnostics): Likewise.
(cxx_types_compatible_p): Likewise.
* cp-tree.h: to here.
(do_poplevel): Add.
* lex.c (D_OBJC): Add.
(init_reswords): Add.
* Make-lang.in (cp/pt.o): Add cp/cp-objcp-common.h.
* parser.c: Add c-common.h include.
* pt.c: Add c-common.h and cp-objcp-common.h includes.
(template_args_equal): Use objc_comptypes as well.
(tsubst_copy_and_build): Use objcp_tsubst_copy_and_build as well.
* semantics.c (do_poplevel): Remove static.
* decl.c (objc_mark_locals_volatile): Don't change decls that are
already ok.
* decl2.c (generate_ctor_or_dtor_function): Add code to initialize
Objective C++ early enough.
* lex.c (struct resword reswords): Add Objective-C++ support.
* parser.c (cp_lexer_get_preprocessor_token): Add Objective-C++.
(cp_parser_objc_message_receiver): Add.
(cp_parser_objc_message_args): Likewise.
(cp_parser_objc_message_expression): Likewise.
(cp_parser_objc_encode_expression): Likewise.
(cp_parser_objc_defs_expression): Likewise.
(cp_parser_objc_protocol_expression): Likewise.
(cp_parser_objc_selector_expression): Likewise.
(cp_parser_objc_expression): Likewise.
(cp_parser_objc_visibility_spec): Likewise.
(cp_parser_objc_method_type): Likewise.
(cp_parser_objc_protocol_qualifiers): Likewise.
(cp_parser_objc_typename): Likewise.
(cp_parser_objc_selector_p): Likewise.
(cp_parser_objc_selector): Likewise.
(cp_parser_objc_method_keyword_params): Likewise.
(cp_parser_objc_method_tail_params_opt): Likewise.
(cp_parser_objc_interstitial_code): Likewise.
(cp_parser_objc_method_signature): Likewise.
(cp_parser_objc_method_prototype_list): Likewise.
(cp_parser_objc_method_definition_list): Likewise.
(cp_parser_objc_class_ivars): Likewise.
(cp_parser_objc_identifier_list): Likewise.
(cp_parser_objc_alias_declaration): Likewise.
(cp_parser_objc_class_declaration): Likewise.
(cp_parser_objc_protocol_declaration): Likewise.
(cp_parser_objc_protocol_refs_opt): Likewise.
(cp_parser_objc_superclass_or_category): Likewise.
(cp_parser_objc_class_interface): Likewise.
(cp_parser_objc_class_implementation): Likewise.
(cp_parser_objc_end_implementation): Likewise.
(cp_parser_objc_declaration): Likewise.
(cp_parser_objc_try_catch_finally_statement): Likewise.
(cp_parser_objc_synchronized_statement): Likewise.
(cp_parser_objc_throw_statement): Likewise.
(cp_parser_objc_statement): Likewise.
(cp_parser_primary_expression): Add Objective-C++.
(cp_parser_statement): Likewise.
(cp_parser_declaration): Likewise.
(cp_parser_simple_type_specifier): Likewise.
(cp_parser_type_name): Likewise.
(cp_parser_parameter_declaration_list): Likewise.
(cp_parser_member_declaration) Likewise.
* tree.c: Include debug.h.
* typeck.c (composite_pointer_type): Add Objective-C++ support.
(finish_class_member_access_expr): Likewise.
(build_function_call): Allow objc to rewrite FUNCTION_DECLs.
(build_modify_expr): Allow objc to generate write barriers.
* Make-lang.in (cp/tree.o): Add debug.h.
* tree.c (lvalue_p_1, case CONST_DECL): Add.
From-SVN: r99855
Diffstat (limited to 'gcc/cp/pt.c')
| -rw-r--r-- | gcc/cp/pt.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9006ab9..f5e3f8a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -34,7 +34,9 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "pointer-set.h" #include "flags.h" +#include "c-common.h" #include "cp-tree.h" +#include "cp-objcp-common.h" #include "tree-inline.h" #include "decl.h" #include "output.h" @@ -4024,7 +4026,24 @@ template_args_equal (tree ot, tree nt) /* For member templates */ return TREE_CODE (ot) == TREE_VEC && comp_template_args (ot, nt); else if (TYPE_P (nt)) - return TYPE_P (ot) && same_type_p (ot, nt); + { + int c1, c2; + + if (!TYPE_P (ot)) + return 0; + + /* We must handle ObjC types specially because they may differ + only in protocol qualifications (e.g., 'NSObject *' vs. + 'NSObject <Foo> *') that must be taken into account here. + See also cp/typeck.c:build_c_cast(), where a similar problem + arises. We must call objc_comptypes() twice, since its + comparisons are _not_ symmetric. */ + if ((c1 = objc_comptypes (ot, nt, 0)) >= 0 + && (c2 = objc_comptypes (nt, ot, 0)) >= 0) + return (c1 && c2); + + return same_type_p (ot, nt); + } else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot)) return 0; else @@ -8880,6 +8899,14 @@ tsubst_copy_and_build (tree t, return t; default: + /* Handle Objective-C++ constructs, if appropriate. */ + { + tree subst + = objcp_tsubst_copy_and_build (t, args, complain, + in_decl, /*function_p=*/false); + if (subst) + return subst; + } return tsubst_copy (t, args, complain, in_decl); } |
