diff options
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/Make-lang.in | 32 | ||||
-rw-r--r-- | gcc/objc/config-lang.in | 6 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 138 | ||||
-rw-r--r-- | gcc/objc/objc-act.h | 3 | ||||
-rw-r--r-- | gcc/objc/objc-dmp-tree.c | 285 | ||||
-rw-r--r-- | gcc/objc/objc-idebug.c | 72 | ||||
-rw-r--r-- | gcc/objc/objc-lang.c | 4 | ||||
-rw-r--r-- | gcc/objc/objc-root.h | 4 |
8 files changed, 528 insertions, 16 deletions
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index 12a20569c67..ecb35b19b5f 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -49,12 +49,23 @@ objc-warn = $(STRICT_WARN) # Bison-1.75 output yields (harmless) -Wtraditional warnings objc/objc-parse.o-warn = -Wno-error +# APPLE LOCAL begin order files ilr +ifeq ($(ORDER_FILES),yes) +CC1OBJ_ORDER_FLAGS = `if [ -f $(srcdir)/../order-files/cc1obj.order ]; then \ + echo -sectorder __TEXT __text $(srcdir)/../order-files/cc1obj.order -e start ; fi` +else +CC1OBJ_ORDER_FLAGS = +endif +# APPLE LOCAL end order files ilr + # Language-specific object files for Objective C. OBJC_OBJS = objc/objc-lang.o objc/objc-parse.o objc/objc-act.o +# APPLE LOCAL order files ilr cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBDEPS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ - $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBS) + $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBS) \ + $(CC1OBJ_ORDER_FLAGS) # Objective C language specific files. @@ -83,7 +94,24 @@ objc/objc-parse.y: c-parse.in echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y sed -e "/^@@ifc.*/,/^@@end_ifc.*/d" \ -e "/^@@ifobjc.*/d" -e "/^@@end_ifobjc.*/d" < $< >>tmp-objc-prs.y - $(SHELL) $(srcdir)/../move-if-change tmp-objc-prs.y $@ + $(SHELL) $(srcdir)/move-if-change tmp-objc-prs.y $@ + +# APPLE LOCAL debugging +objc/objc-idebug.o : $(srcdir)/objc/objc-idebug.c $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \ + $(RTL_H) $(srcdir)/objc/objc-act.h flags.h c-idebug.c idebug.c + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ + -c -Wno-traditional -w $(srcdir)/objc/objc-idebug.c $(OUTPUT_OPTION) + +# APPLE LOCAL new tree dump +# APPLE LOCAL separate outputdir +objc/objc-dmp-tree.o: objc/objc-dmp-tree.c c-dmp-tree.c dmp-tree.c \ + $(CONFIG_H) $(TREE_H) $(SYSTEM_H) $(srcdir)/c-common.h $(TM_H) coretypes.h \ + $(srcdir)/objc/objc-act.h \ + $(srcdir)/c-tree.h \ + $(srcdir)/dmp-tree.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ + -c $(srcdir)/objc/objc-dmp-tree.c $(OUTPUT_OPTION) gtype-objc.h : s-gtype ; @true gt-objc-objc-act.h : s-gtype ; @true diff --git a/gcc/objc/config-lang.in b/gcc/objc/config-lang.in index 91b86d8d573..996c914cd86 100644 --- a/gcc/objc/config-lang.in +++ b/gcc/objc/config-lang.in @@ -32,6 +32,10 @@ compilers="cc1obj\$(exeext)" stagestuff="cc1obj\$(exeext)" -target_libs=target-libobjc +# APPLE LOCAL begin libobjc +# We use libobjc4 instead. To build libobjc anyway, add +# '--enable-libobjc' to the 'configure' command line. +# target_libs=target-libobjc +# APPLE LOCAL end libobjc gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/c-parse.in \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c \$(srcdir)/objc/objc-act.c" diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 3fe26d3fd87..e300197a18b 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -47,7 +47,14 @@ Boston, MA 02111-1307, USA. */ #include "rtl.h" #include "tm_p.h" #include "expr.h" +/* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS +#include "cp-tree.h" +#include "lex.h" +#else #include "c-tree.h" +#endif +/* APPLE LOCAL end Objective-C++ */ #include "c-common.h" #include "flags.h" #include "langhooks.h" @@ -66,6 +73,23 @@ Boston, MA 02111-1307, USA. */ #define OBJC_VOID_AT_END build_tree_list (NULL_TREE, void_type_node) +/* APPLE LOCAL begin Objective-C++ */ +/* When building Objective-C++, we are not linking against the C front-end + and so need to replicate the C tree-construction functions in some way. */ +#ifdef OBJCPLUS +#define OBJCP_REMAP_FUNCTIONS +#include "objcp-decl.h" +#endif /* OBJCPLUS */ +/* APPLE LOCAL end Objective-C++ */ + +/* APPLE LOCAL new tree dump */ +#ifdef ENABLE_DMP_TREE +#include "dmp-tree.h" +extern int c_dump_tree_p PARAMS ((FILE *, const char *, tree, int)); +extern int objc_dump_tree_p PARAMS ((FILE *, const char *, tree, int)); +extern lang_dump_tree_p_t objc_prev_lang_dump_tree_p; +#endif + /* This is the default way of generating a method name. */ /* I am not sure it is really correct. Perhaps there's a danger that it will make name conflicts @@ -186,7 +210,8 @@ static void hash_add_attr (hash, tree); static tree lookup_method (tree, tree); static tree lookup_method_static (tree, tree, int); static void add_method_to_hash_list (hash *, tree); -static tree add_class (tree); +/* APPLE LOCAL objc speedup dpatel */ +static tree add_class (tree, tree); static void add_category (tree, tree); static inline tree lookup_category (tree, tree); @@ -495,6 +520,19 @@ objc_init (void) not to be built in. */ input_line = 0; +/* APPLE LOCAL new tree dump */ +#ifdef ENABLE_DMP_TREE + if (!objc_prev_lang_dump_tree_p) + objc_prev_lang_dump_tree_p = set_dump_tree_p (objc_dump_tree_p); + /* At this point, objc_prev_lang_dump_tree_p should point at the C tree + dump routine (which, in the case of Objective-C++, points at the C++ + tree dump routine in turn). */ + if (objc_prev_lang_dump_tree_p != &c_dump_tree_p) + abort (); + + SET_MAX_DMP_TREE_CODE (LAST_OBJC_TREE_CODE); +#endif + /* If gen_declaration desired, open the output file. */ if (flag_gen_declaration) { @@ -1141,6 +1179,12 @@ synth_module_prologue (void) { tree temp_type; + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + push_lang_context (lang_name_c); /* extern "C" */ +#endif + /* APPLE LOCAL end Objective-C++ */ + /* Defined in `objc.h' */ objc_object_id = get_identifier (TAG_OBJECT); @@ -1320,7 +1364,13 @@ synth_module_prologue (void) #ifndef OBJCPLUS /* The C++ front-end does not appear to grok __attribute__((__unused__)). */ unused_list = build_tree_list (get_identifier ("__unused__"), NULL_TREE); -#endif +#endif + + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + pop_lang_context (); +#endif + /* APPLE LOCAL end Objective-C++ */ } /* Ensure that the ivar list for NSConstantString/NXConstantString @@ -1384,6 +1434,15 @@ build_objc_string_object (tree string) string = fix_string_type (string); + /* APPLE LOCAL begin constant cfstrings */ + /* The target may have different ideas on how to construct an + ObjC string literal. On Darwin (Mac OS X), for example, + we may wish to obtain a constant CFString reference instead. */ + constructor = (*targetm.construct_objc_string) (string); + if (constructor) + return build_c_cast (id_type, constructor); + /* APPLE LOCAL end constant cfstrings */ + constant_string_class = lookup_interface (constant_string_id); if (!constant_string_class || !(constant_string_type @@ -1804,6 +1863,12 @@ build_module_descriptor (void) { tree decl_specs, field_decl, field_decl_chain; + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + push_lang_context (lang_name_c); /* extern "C" */ +#endif + /* APPLE LOCAL end Objective-C++ */ + objc_module_template = start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE)); @@ -1914,6 +1979,11 @@ build_module_descriptor (void) c_expand_expr_stmt (decelerator); finish_function (); + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + pop_lang_context (); +#endif + /* APPLE LOCAL end Objective-C++ */ return XEXP (DECL_RTL (init_function_decl), 0); } @@ -2586,18 +2656,18 @@ objc_is_object_ptr (tree type) tree lookup_interface (tree ident) { - tree chain; + /* APPLE LOCAL objc speedup dpatel */ + tree chain ATTRIBUTE_UNUSED; #ifdef OBJCPLUS if (ident && TREE_CODE (ident) == TYPE_DECL) ident = DECL_NAME (ident); #endif - for (chain = interface_chain; chain; chain = TREE_CHAIN (chain)) - { - if (ident == CLASS_NAME (chain)) - return chain; - } - return NULL_TREE; + /* APPLE LOCAL begin objc speedup dpatel */ + return (ident && TREE_CODE (ident) == IDENTIFIER_NODE + ? IDENTIFIER_INTERFACE_VALUE (ident) + : NULL_TREE); + /* APPLE LOCAL end objc speedup dpatel */ } /* Implement @defs (<classname>) within struct bodies. */ @@ -6342,9 +6412,14 @@ objc_add_method (tree class, tree method, int is_class) return method; } +/* APPLE LOCAL begin objc speedup dpatel */ +/* New parameter, name */ static tree -add_class (tree class) +add_class (tree class, tree name) { + /* APPLE LOCAL end objc speedup dpatel */ + IDENTIFIER_INTERFACE_VALUE (name) = class; + /* Put interfaces on list in reverse order. */ TREE_CHAIN (class) = interface_chain; interface_chain = class; @@ -6815,7 +6890,9 @@ start_class (enum tree_code code, tree class_name, tree super_name, { warning ("cannot find interface declaration for `%s'", IDENTIFIER_POINTER (class_name)); - add_class (implementation_template = objc_implementation_context); + /* APPLE LOCAL objc speedup dpatel */ + /* Add second parameter class_name */ + add_class (implementation_template = objc_implementation_context, class_name); } /* If a super class has been specified in the implementation, @@ -6848,8 +6925,10 @@ start_class (enum tree_code code, tree class_name, tree super_name, warning ("duplicate interface declaration for class `%s'", #endif IDENTIFIER_POINTER (class_name)); - else - add_class (class); + else + /* APPLE LOCAL objc speedup dpatel */ + /* Add second parameter, class_name */ + add_class (class, class_name); if (protocol_list) CLASS_PROTOCOL_LIST (class) @@ -6915,6 +6994,12 @@ continue_class (tree class) /* code generation */ + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + push_lang_context (lang_name_c); +#endif + /* APPLE LOCAL end Objective-C++ */ + ivar_context = build_private_template (implementation_template); if (!objc_class_template) @@ -6937,14 +7022,34 @@ continue_class (tree class) else cat_count++; + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + pop_lang_context (); +#endif /* OBJCPLUS */ + /* APPLE LOCAL end Objective-C++ */ + return ivar_context; } else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE) { +/* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + push_lang_context (lang_name_c); +#endif /* OBJCPLUS */ +/* APPLE LOCAL end Objective-C++ */ if (!CLASS_STATIC_TEMPLATE (class)) { tree record = start_struct (RECORD_TYPE, CLASS_NAME (class)); + + /* APPLE LOCAL begin 3261135 */ + /* FSF Candidate */ + /* Set the TREE_USED bit for this struct, so that stab generator can emit + stabs for this struct type. */ + if (flag_debug_only_used_symbols && TYPE_STUB_DECL (record)) + TREE_USED (TYPE_STUB_DECL (record)) = 1; + /* APPLE LOCAL end 3261135 */ + finish_struct (record, get_class_ivars (class, 0), NULL_TREE); CLASS_STATIC_TEMPLATE (class) = record; @@ -6952,6 +7057,11 @@ continue_class (tree class) TREE_STATIC_TEMPLATE (record) = 1; } + /* APPLE LOCAL begin Objective-C++ */ +#ifdef OBJCPLUS + pop_lang_context (); +#endif /* OBJCPLUS */ + /* APPLE LOCAL end Objective-C++ */ return NULL_TREE; } @@ -9086,5 +9196,7 @@ lookup_objc_ivar (tree id) return 0; } +/* APPLE LOCAL objective-C++ */ +#include "gt-objc-objc-act-h.h" #include "gt-objc-objc-act.h" #include "gtype-objc.h" diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index abbf6562731..8c19b563691 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -126,6 +126,9 @@ tree build_encode_expr (tree); ? (TYPE)->type.context : NULL_TREE) #define SET_TYPE_PROTOCOL_LIST(TYPE, P) (TYPE_CHECK (TYPE)->type.context = (P)) +/* APPLE LOCAL objc speedup dpatel */ +#define IDENTIFIER_INTERFACE_VALUE(NODE) (((struct lang_identifier *) (NODE))->interface_value) + /* Set by `continue_class' and checked by `is_public'. */ #define TREE_STATIC_TEMPLATE(record_type) (TREE_PUBLIC (record_type)) diff --git a/gcc/objc/objc-dmp-tree.c b/gcc/objc/objc-dmp-tree.c new file mode 100644 index 00000000000..14d9dabfca1 --- /dev/null +++ b/gcc/objc/objc-dmp-tree.c @@ -0,0 +1,285 @@ +/* APPLE LOCAL file new tree dump */ +/* Common condensed tree display routines specific for objc and objc++. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Ira L. Ruben (ira@apple.com) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* The Objective-C++ and Objective-C tree dump handling is piggybacked + on either C++ or C tree dump handling. */ + +#ifdef OBJCPLUS +#include "cp-dmp-tree.c" +#else +#include "c-dmp-tree.c" +#endif + +#include "objc-act.h" + +int objc_dump_tree_p (FILE *, const char *, tree, int); +lang_dump_tree_p_t objc_prev_lang_dump_tree_p = NULL; + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \ +static void print_ ## SYM (FILE *file, const char *annotation, tree node, int indent); +#include "objc-tree.def" +#undef DEFTREECODE + +/*-------------------------------------------------------------------*/ + +static void +print_CLASS_INTERFACE_TYPE (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + tree n; + + if (CLASS_SUPER_NAME (node)) + fprintf (file, " super-name=%s", + IDENTIFIER_POINTER (CLASS_SUPER_NAME (node))); + /* The ivars for the class are accessible either via + CLASS_IVARS(node), or as fields of the + underlying C struct (itself accessible via + CLASS_STATIC_TEMPLATE(node). */ + fprintf (file, " ivars="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (CLASS_IVARS (node))); + /* zlaski 2001-Jul-26: not sure what the raw ivars are for... */ + fprintf (file, " raw_ivars="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (CLASS_RAW_IVARS (node))); + /* The "own ivars" list contains just the ivars defined by this + class (i.e., not inherited). */ + fprintf (file, " own_ivars="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (CLASS_OWN_IVARS (node))); + + print_type (file, annotation, node, indent); + (void)node_seen (node, TRUE); + + /* print out names of protocols, categories. */ + for (n = CLASS_PROTOCOL_LIST (node); n; n = TREE_CHAIN (n)) + print_type (file, NULL, TREE_VALUE (n), indent + INDENT); + for (n = CLASS_CATEGORY_LIST (node); n; n = TREE_CHAIN (n)) + print_type (file, NULL, TREE_VALUE (n), indent + INDENT); + + /* Print the underlying RECORD_TYPE node, with fields. */ + dump_tree (file, annotation, CLASS_STATIC_TEMPLATE (node), + indent + INDENT); + /* Print out names of class and instance methods. */ + for (n = CLASS_CLS_METHODS (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, n, indent + INDENT); + for (n = CLASS_NST_METHODS (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, n, indent + INDENT); +} + +static void +print_CLASS_IMPLEMENTATION_TYPE (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + print_CLASS_INTERFACE_TYPE (file, annotation, node, indent); +} + +static void +print_CATEGORY_INTERFACE_TYPE (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + tree n; + + fprintf (file, " cat-name=%s", + IDENTIFIER_POINTER (CLASS_SUPER_NAME (node))); + print_type (file, annotation, node, indent); + (void)node_seen (node, TRUE); + + for (n = CLASS_PROTOCOL_LIST (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, TREE_VALUE (n), indent + INDENT); + /* Print out names of class and instance methods. */ + for (n = CLASS_CLS_METHODS (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, n, indent + INDENT); + for (n = CLASS_NST_METHODS (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, n, indent + INDENT); +} + +static void +print_CATEGORY_IMPLEMENTATION_TYPE (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + print_CATEGORY_INTERFACE_TYPE (file, annotation, node, indent); +} + +static void +print_PROTOCOL_INTERFACE_TYPE (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + tree n; + + fprintf (file, " fwd-decl="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (PROTOCOL_FORWARD_DECL (node))); + fprintf (file, " defined=%d", PROTOCOL_DEFINED (node)); + + print_type (file, annotation, node, indent); + (void)node_seen (node, TRUE); + + /* print superprotocols, if any. */ + for (n = PROTOCOL_LIST (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, TREE_VALUE (n), indent + INDENT); + + /* Print out names of class and instance methods. */ + for (n = PROTOCOL_CLS_METHODS (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, n, indent + INDENT); + for (n = PROTOCOL_NST_METHODS (node); n; n = TREE_CHAIN (n)) + dump_tree (file, NULL, n, indent + INDENT); +} + +static void +print_KEYWORD_DECL (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + fprintf (file, " key=%s", + IDENTIFIER_POINTER (KEYWORD_KEY_NAME (node))); + fprintf (file, " arg=%s", + IDENTIFIER_POINTER (KEYWORD_ARG_NAME (node))); + + print_type (file, annotation, node, indent); + (void)node_seen (node, TRUE); +} + +static void +print_INSTANCE_METHOD_DECL (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + fprintf (file, " args="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (METHOD_SEL_ARGS (node))); + fprintf (file, " addl="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (METHOD_ADD_ARGS (node))); + if (METHOD_ENCODING (node)) + fprintf (file, " encode=%s", + IDENTIFIER_POINTER (METHOD_ENCODING (node))); + + print_decl (file, annotation, node, indent); + + /* Print the underlying FUNCTION_DECL node. */ + if (METHOD_DEFINITION (node)) + dump_tree (file, annotation, METHOD_DEFINITION (node), + indent + INDENT); + + (void)node_seen (node, TRUE); +} + +static void +print_CLASS_METHOD_DECL (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + print_INSTANCE_METHOD_DECL (file, annotation, node, indent); +} + +static void +print_CLASS_REFERENCE_EXPR (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + fprintf (file, " ident="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 0))); + (void)node_seen (node, TRUE); +} + +static void +print_MESSAGE_SEND_EXPR (file, annotation, node, indent) + FILE *file ATTRIBUTE_UNUSED; + const char *annotation ATTRIBUTE_UNUSED; + tree node ATTRIBUTE_UNUSED; + int indent ATTRIBUTE_UNUSED; +{ + fprintf (file, " receiver="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 0))); + fprintf (file, " sel_name=%s", + IDENTIFIER_POINTER (TREE_OPERAND (node, 1))); + fprintf (file, " args="); + fprintf (file, HOST_PTR_PRINTF, + HOST_PTR_PRINTF_VALUE (TREE_OPERAND (node, 2))); + (void)node_seen (node, TRUE); +} + +/*-------------------------------------------------------------------*/ + +int +objc_dump_tree_p (file, annotation, node, indent) + FILE *file; + const char *annotation ATTRIBUTE_UNUSED; + tree node; + int indent; +{ + switch (TREE_CODE (node)) + { +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) \ + case SYM: print_ ## SYM (file, annotation, node, indent); break; +#include "objc-tree.def" +#undef DEFTREECODE + default: + return objc_prev_lang_dump_tree_p (file, annotation, node, indent); + } + + return 1; +} + + +/*-------------------------------------------------------------------*/ + +#if 0 + +cd $gcc3/gcc; \ +cc -no-cpp-precomp -c -DIN_GCC -g \ + -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long \ + -DHAVE_CONFIG_H \ + -I$gcc3obj \ + -I. \ + -Iobjc \ + -Iconfig \ + -I../include \ + objc/objc-dmp-tree.c -o ~/tmp.o -w + +#endif diff --git a/gcc/objc/objc-idebug.c b/gcc/objc/objc-idebug.c new file mode 100644 index 00000000000..4bf78cdd18a --- /dev/null +++ b/gcc/objc/objc-idebug.c @@ -0,0 +1,72 @@ +/* APPLE LOCAL file debugging */ +/* ObjC tree & rtl accessors defined as functions for use in a debugger. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Ira L. Ruben (ira@apple.com) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* What we do here is to instantiate each macro as a function *BY + THE SAME NAME*. Depends on the macro not being expanded when + it is surrounded by parens. + + Note that this file includes idebug.c or cp/cp-idebug.c (depending + on weather OBJCPLUS is defined) so that only debugging macros for + objc-act.h are actually defined here. For objc only this file is + included in the link while for C only idebug.c is built and inlcuded + in the link. Similarly, for objc++ this is the only included file + and cp-idebug.c is not linked. */ + +#ifdef OBJCPLUS +#include "cp/cp-idebug.c" +#else +#include "c-idebug.c" +#endif + +#ifdef ENABLE_IDEBUG + +#include "objc-act.h" + +/* Macros from objc/objc-act.h */ + +fn_1 ( KEYWORD_KEY_NAME, tree, tree ) +fn_1 ( KEYWORD_ARG_NAME, tree, tree ) +fn_1 ( METHOD_SEL_NAME, tree, tree ) +fn_1 ( METHOD_SEL_ARGS, tree, tree ) +fn_1 ( METHOD_ADD_ARGS, tree, tree ) +fn_1 ( METHOD_DEFINITION, tree, tree ) +fn_1 ( METHOD_ENCODING, tree, tree ) +fn_1 ( CLASS_NAME, tree, tree ) +fn_1 ( CLASS_SUPER_NAME, tree, tree ) +fn_1 ( CLASS_IVARS, tree, tree ) +fn_1 ( CLASS_RAW_IVARS, tree, tree ) +fn_1 ( CLASS_NST_METHODS, tree, tree ) +fn_1 ( CLASS_CLS_METHODS, tree, tree ) +fn_1 ( CLASS_OWN_IVARS, tree, tree ) +fn_1 ( CLASS_STATIC_TEMPLATE, tree, tree ) +fn_1 ( CLASS_CATEGORY_LIST, tree, tree ) +fn_1 ( CLASS_PROTOCOL_LIST, tree, tree ) +fn_1 ( PROTOCOL_NAME, tree, tree ) +fn_1 ( PROTOCOL_LIST, tree, tree ) +fn_1 ( PROTOCOL_NST_METHODS, tree, tree ) +fn_1 ( PROTOCOL_CLS_METHODS, tree, tree ) +fn_1 ( PROTOCOL_FORWARD_DECL, tree, tree ) +fn_1 ( PROTOCOL_DEFINED, tree, tree ) +fn_1 ( TREE_STATIC_TEMPLATE, int, tree ) +fn_1 ( TYPE_PROTOCOL_LIST, tree, tree) + +#endif /* ENABLE_IDEBUG */ diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 8f5692cad11..621d006a16b 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -39,6 +39,10 @@ enum c_language_kind c_language = clk_objc; #define LANG_HOOKS_INIT objc_init #undef LANG_HOOKS_FINISH #define LANG_HOOKS_FINISH c_common_finish +/* APPLE LOCAL begin Objective-C++ */ +#undef LANG_HOOKS_FINISH_FILE +#define LANG_HOOKS_FINISH_FILE finish_file +/* APPLE LOCAL end Objective-C++ */ #undef LANG_HOOKS_INIT_OPTIONS #define LANG_HOOKS_INIT_OPTIONS c_common_init_options #undef LANG_HOOKS_HANDLE_OPTION diff --git a/gcc/objc/objc-root.h b/gcc/objc/objc-root.h new file mode 100644 index 00000000000..96d86209715 --- /dev/null +++ b/gcc/objc/objc-root.h @@ -0,0 +1,4 @@ +/* APPLE LOCAL file Objective-C++ */ +/* Empty file to be the base for gtype-objc.h. */ + +extern GTY(()) tree objc_dummy; |