aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc/objc-act.h
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@apple.com>2001-10-03 22:05:57 +0000
committerStan Shebs <shebs@gcc.gnu.org>2001-10-03 22:05:57 +0000
commit8607f1bc473e87792faff282e2522c2e971a9a94 (patch)
treea9086dda614a021f61ce4b8b7024b034cf3e5ecc /gcc/objc/objc-act.h
parent8bf4eeece3076a35dbfe8d7385b4fef2488337d6 (diff)
downloadgcc-8607f1bc473e87792faff282e2522c2e971a9a94.zip
gcc-8607f1bc473e87792faff282e2522c2e971a9a94.tar.gz
gcc-8607f1bc473e87792faff282e2522c2e971a9a94.tar.bz2
c-parse.in (objc_inherit_code, [...]): Make static.
2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
Diffstat (limited to 'gcc/objc/objc-act.h')
-rw-r--r--gcc/objc/objc-act.h247
1 files changed, 241 insertions, 6 deletions
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index e659f91..2825970 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -46,6 +46,7 @@ tree get_class_reference PARAMS ((tree));
tree get_static_reference PARAMS ((tree, tree));
tree get_object_reference PARAMS ((tree));
tree build_message_expr PARAMS ((tree));
+tree finish_message_expr PARAMS ((tree, tree, tree));
tree build_selector_expr PARAMS ((tree));
tree build_ivar_reference PARAMS ((tree));
tree build_keyword_decl PARAMS ((tree, tree, tree));
@@ -53,10 +54,6 @@ tree build_method_decl PARAMS ((enum tree_code, tree, tree, tree));
tree build_protocol_expr PARAMS ((tree));
tree build_objc_string_object PARAMS ((tree));
-extern tree objc_ivar_chain;
-extern tree objc_method_context;
-extern tree objc_ellipsis_node;
-
void objc_declare_alias PARAMS ((tree, tree));
void objc_declare_class PARAMS ((tree));
void objc_declare_protocols PARAMS ((tree));
@@ -105,16 +102,254 @@ tree build_encode_expr PARAMS ((tree));
#define PROTOCOL_DEFINED(CLASS) TREE_USED (CLASS)
#define TYPE_PROTOCOL_LIST(TYPE) ((TYPE)->type.context)
+/* Set by `continue_class' and checked by `is_public'. */
+
+#define TREE_STATIC_TEMPLATE(record_type) (TREE_PUBLIC (record_type))
+#define TYPED_OBJECT(type) \
+ (TREE_CODE (type) == RECORD_TYPE && TREE_STATIC_TEMPLATE (type))
+
/* Define the Objective-C or Objective-C++ language-specific tree codes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
enum objc_tree_code {
#ifdef OBJCPLUS
- dummy_tree_code = LAST_CPLUS_TREE_CODE,
+ LAST_BASE_TREE_CODE = LAST_CPLUS_TREE_CODE,
#else
- dummy_tree_code = LAST_C_TREE_CODE,
+ LAST_BASE_TREE_CODE = LAST_C_TREE_CODE,
#endif
#include "objc-tree.def"
LAST_OBJC_TREE_CODE
};
#undef DEFTREECODE
+
+/* Hash tables to manage the global pool of method prototypes. */
+
+typedef struct hashed_entry *hash;
+typedef struct hashed_attribute *attr;
+
+struct hashed_attribute
+{
+ attr next;
+ tree value;
+};
+struct hashed_entry
+{
+ attr list;
+ hash next;
+ tree key;
+};
+
+extern hash *nst_method_hash_list;
+extern hash *cls_method_hash_list;
+
+#define HASH_ALLOC_LIST_SIZE 170
+#define ATTR_ALLOC_LIST_SIZE 170
+#define SIZEHASHTABLE 257
+
+/* Objective-C/Objective-C++ @implementation list. */
+
+struct imp_entry
+{
+ struct imp_entry *next;
+ tree imp_context;
+ tree imp_template;
+ tree class_decl; /* _OBJC_CLASS_<my_name>; */
+ tree meta_decl; /* _OBJC_METACLASS_<my_name>; */
+};
+
+extern struct imp_entry *imp_list;
+extern int imp_count; /* `@implementation' */
+extern int cat_count; /* `@category' */
+
+/* Objective-C/Objective-C++ global tree enumeration. */
+
+enum objc_tree_index
+{
+ OCTI_STATIC_NST,
+ OCTI_STATIC_NST_DECL,
+ OCTI_SELF_ID,
+ OCTI_UCMD_ID,
+ OCTI_UNUSED_LIST,
+ OCTI_ELLIPSIS_NODE,
+
+ OCTI_SELF_DECL,
+ OCTI_UMSG_DECL,
+ OCTI_UMSG_SUPER_DECL,
+ OCTI_GET_CLASS_DECL,
+ OCTI_GET_MCLASS_DECL,
+ OCTI_SUPER_TYPE,
+ OCTI_SEL_TYPE,
+ OCTI_ID_TYPE,
+ OCTI_CLS_TYPE,
+ OCTI_NST_TYPE,
+ OCTI_PROTO_TYPE,
+
+ OCTI_CLS_CHAIN,
+ OCTI_ALIAS_CHAIN,
+ OCTI_INTF_CHAIN,
+ OCTI_PROTO_CHAIN,
+ OCTI_IMPL_CHAIN,
+ OCTI_CLS_REF_CHAIN,
+ OCTI_SEL_REF_CHAIN,
+ OCTI_IVAR_CHAIN,
+ OCTI_CLS_NAMES_CHAIN,
+ OCTI_METH_VAR_NAMES_CHAIN,
+ OCTI_METH_VAR_TYPES_CHAIN,
+
+ OCTI_SYMBOLS_DECL,
+ OCTI_NST_VAR_DECL,
+ OCTI_CLS_VAR_DECL,
+ OCTI_NST_METH_DECL,
+ OCTI_CLS_METH_DECL,
+ OCTI_CLS_DECL,
+ OCTI_MCLS_DECL,
+ OCTI_SEL_TABLE_DECL,
+ OCTI_MODULES_DECL,
+ OCTI_STRG_DECL,
+
+ OCTI_INTF_CTX,
+ OCTI_IMPL_CTX,
+ OCTI_METH_CTX,
+ OCTI_IVAR_CTX,
+
+ OCTI_IMPL_TEMPL,
+ OCTI_CLS_TEMPL,
+ OCTI_CAT_TEMPL,
+ OCTI_UPRIV_REC,
+ OCTI_PROTO_TEMPL,
+ OCTI_SEL_TEMPL,
+ OCTI_UCLS_SUPER_REF,
+ OCTI_UUCLS_SUPER_REF,
+ OCTI_METH_TEMPL,
+ OCTI_IVAR_TEMPL,
+ OCTI_SYMTAB_TEMPL,
+ OCTI_MODULE_TEMPL,
+ OCTI_SUPER_TEMPL,
+ OCTI_OBJ_REF,
+ OCTI_METH_PROTO_TEMPL,
+ OCTI_FUNCTION1_TEMPL,
+ OCTI_FUNCTION2_TEMPL,
+
+ OCTI_OBJ_ID,
+ OCTI_CLS_ID,
+ OCTI_ID_ID,
+ OCTI_CNST_STR_ID,
+ OCTI_CNST_STR_TYPE,
+ OCTI_CNST_STR_GLOB_ID,
+ OCTI_STRING_CLASS_DECL,
+ OCTI_SUPER_DECL,
+
+ OCTI_MAX
+};
+
+extern tree objc_global_trees[OCTI_MAX];
+
+/* List of classes with list of their static instances. */
+#define objc_static_instances objc_global_trees[OCTI_STATIC_NST]
+
+/* The declaration of the array administrating the static instances. */
+#define static_instances_decl objc_global_trees[OCTI_STATIC_NST_DECL]
+
+/* Some commonly used instances of "identifier_node". */
+
+#define self_id objc_global_trees[OCTI_SELF_ID]
+#define ucmd_id objc_global_trees[OCTI_UCMD_ID]
+#define unused_list objc_global_trees[OCTI_UNUSED_LIST]
+#define objc_ellipsis_node objc_global_trees[OCTI_ELLIPSIS_NODE]
+
+#define self_decl objc_global_trees[OCTI_SELF_DECL]
+#define umsg_decl objc_global_trees[OCTI_UMSG_DECL]
+#define umsg_super_decl objc_global_trees[OCTI_UMSG_SUPER_DECL]
+#define objc_get_class_decl objc_global_trees[OCTI_GET_CLASS_DECL]
+#define objc_get_meta_class_decl \
+ objc_global_trees[OCTI_GET_MCLASS_DECL]
+
+#define super_type objc_global_trees[OCTI_SUPER_TYPE]
+#define selector_type objc_global_trees[OCTI_SEL_TYPE]
+#define id_type objc_global_trees[OCTI_ID_TYPE]
+#define objc_class_type objc_global_trees[OCTI_CLS_TYPE]
+#define instance_type objc_global_trees[OCTI_NST_TYPE]
+#define protocol_type objc_global_trees[OCTI_PROTO_TYPE]
+
+/* Type checking macros. */
+
+#define IS_ID(TYPE) \
+ (TYPE_MAIN_VARIANT (TYPE) == TYPE_MAIN_VARIANT (id_type))
+#define IS_PROTOCOL_QUALIFIED_ID(TYPE) \
+ (IS_ID (TYPE) && TYPE_PROTOCOL_LIST (TYPE))
+#define IS_SUPER(TYPE) \
+ (super_type && TYPE_MAIN_VARIANT (TYPE) == TYPE_MAIN_VARIANT (super_type))
+
+#define class_chain objc_global_trees[OCTI_CLS_CHAIN]
+#define alias_chain objc_global_trees[OCTI_ALIAS_CHAIN]
+#define interface_chain objc_global_trees[OCTI_INTF_CHAIN]
+#define protocol_chain objc_global_trees[OCTI_PROTO_CHAIN]
+#define implemented_classes objc_global_trees[OCTI_IMPL_CHAIN]
+
+/* Chains to manage selectors that are referenced and defined in the
+ module. */
+
+#define cls_ref_chain objc_global_trees[OCTI_CLS_REF_CHAIN] /* Classes referenced. */
+#define sel_ref_chain objc_global_trees[OCTI_SEL_REF_CHAIN] /* Selectors referenced. */
+#define objc_ivar_chain objc_global_trees[OCTI_IVAR_CHAIN]
+
+/* Chains to manage uniquing of strings. */
+
+#define class_names_chain objc_global_trees[OCTI_CLS_NAMES_CHAIN]
+#define meth_var_names_chain objc_global_trees[OCTI_METH_VAR_NAMES_CHAIN]
+#define meth_var_types_chain objc_global_trees[OCTI_METH_VAR_TYPES_CHAIN]
+
+
+/* Backend data declarations. */
+
+#define UOBJC_SYMBOLS_decl objc_global_trees[OCTI_SYMBOLS_DECL]
+#define UOBJC_INSTANCE_VARIABLES_decl objc_global_trees[OCTI_NST_VAR_DECL]
+#define UOBJC_CLASS_VARIABLES_decl objc_global_trees[OCTI_CLS_VAR_DECL]
+#define UOBJC_INSTANCE_METHODS_decl objc_global_trees[OCTI_NST_METH_DECL]
+#define UOBJC_CLASS_METHODS_decl objc_global_trees[OCTI_CLS_METH_DECL]
+#define UOBJC_CLASS_decl objc_global_trees[OCTI_CLS_DECL]
+#define UOBJC_METACLASS_decl objc_global_trees[OCTI_MCLS_DECL]
+#define UOBJC_SELECTOR_TABLE_decl objc_global_trees[OCTI_SEL_TABLE_DECL]
+#define UOBJC_MODULES_decl objc_global_trees[OCTI_MODULES_DECL]
+#define UOBJC_STRINGS_decl objc_global_trees[OCTI_STRG_DECL]
+
+/* The following are used when compiling a class implementation.
+ implementation_template will normally be an interface, however if
+ none exists this will be equal to objc_implementation_context...it is
+ set in start_class. */
+
+#define objc_interface_context objc_global_trees[OCTI_INTF_CTX]
+#define objc_implementation_context objc_global_trees[OCTI_IMPL_CTX]
+#define objc_method_context objc_global_trees[OCTI_METH_CTX]
+#define objc_ivar_context objc_global_trees[OCTI_IVAR_CTX]
+
+#define implementation_template objc_global_trees[OCTI_IMPL_TEMPL]
+#define objc_class_template objc_global_trees[OCTI_CLS_TEMPL]
+#define objc_category_template objc_global_trees[OCTI_CAT_TEMPL]
+#define uprivate_record objc_global_trees[OCTI_UPRIV_REC]
+#define objc_protocol_template objc_global_trees[OCTI_PROTO_TEMPL]
+#define objc_selector_template objc_global_trees[OCTI_SEL_TEMPL]
+#define ucls_super_ref objc_global_trees[OCTI_UCLS_SUPER_REF]
+#define uucls_super_ref objc_global_trees[OCTI_UUCLS_SUPER_REF]
+
+#define objc_method_template objc_global_trees[OCTI_METH_TEMPL]
+#define objc_ivar_template objc_global_trees[OCTI_IVAR_TEMPL]
+#define objc_symtab_template objc_global_trees[OCTI_SYMTAB_TEMPL]
+#define objc_module_template objc_global_trees[OCTI_MODULE_TEMPL]
+#define objc_super_template objc_global_trees[OCTI_SUPER_TEMPL]
+#define objc_object_reference objc_global_trees[OCTI_OBJ_REF]
+#define objc_method_prototype_template \
+ objc_global_trees[OCTI_METH_PROTO_TEMPL]
+#define function1_template objc_global_trees[OCTI_FUNCTION1_TEMPL]
+#define function2_template objc_global_trees[OCTI_FUNCTION2_TEMPL]
+
+#define objc_object_id objc_global_trees[OCTI_OBJ_ID]
+#define objc_class_id objc_global_trees[OCTI_CLS_ID]
+#define objc_id_id objc_global_trees[OCTI_ID_ID]
+#define constant_string_id objc_global_trees[OCTI_CNST_STR_ID]
+#define constant_string_type objc_global_trees[OCTI_CNST_STR_TYPE]
+#define constant_string_global_id \
+ objc_global_trees[OCTI_CNST_STR_GLOB_ID]
+#define string_class_decl objc_global_trees[OCTI_STRING_CLASS_DECL]
+#define UOBJC_SUPER_decl objc_global_trees[OCTI_SUPER_DECL]
+