diff options
author | Richard Henderson <rth@redhat.com> | 2001-12-11 17:40:58 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2001-12-11 17:40:58 -0800 |
commit | c66c59d18298436c9b5fe29df16f499d843ba75a (patch) | |
tree | 116b36391006dca608659e14300f2f778e95ce31 /gcc | |
parent | 0b09835f1f9a32e9a4d30d47692d2f4809db6bb3 (diff) | |
download | gcc-c66c59d18298436c9b5fe29df16f499d843ba75a.zip gcc-c66c59d18298436c9b5fe29df16f499d843ba75a.tar.gz gcc-c66c59d18298436c9b5fe29df16f499d843ba75a.tar.bz2 |
objc-act.c (build_string_class_template): New.
* objc/objc-act.c (build_string_class_template): New.
(build_objc_string_object): Call it.
From-SVN: r47908
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 38 |
2 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 919f955..6d2a91f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-12-11 Richard Henderson <rth@redhat.com> + + * objc/objc-act.c (build_string_class_template): New. + (build_objc_string_object): Call it. + 2001-12-11 Steve Ellcey <sje@cup.hp.com> * doc/tm.texi (FUNCTION_ARG_REG_LITTLE_ENDIAN): New. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 03e4b04..3c696ac 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -278,6 +278,7 @@ static tree lookup_protocol_in_reflist PARAMS ((tree, tree)); static tree create_builtin_decl PARAMS ((enum tree_code, tree, const char *)); static void setup_string_decl PARAMS ((void)); +static void build_string_class_template PARAMS ((void)); static tree my_build_string PARAMS ((int, const char *)); static void build_objc_symtab_template PARAMS ((void)); static tree init_def_list PARAMS ((tree)); @@ -1231,11 +1232,39 @@ synth_module_prologue () /* Forward declare constant_string_id and constant_string_type. */ if (!constant_string_class_name) constant_string_class_name = STRING_OBJECT_CLASS_NAME; - + constant_string_id = get_identifier (constant_string_class_name); constant_string_type = xref_tag (RECORD_TYPE, constant_string_id); } +/* Predefine the following data type: + + struct STRING_OBJECT_CLASS_NAME + { + Object isa; + char *cString; + unsigned int length; + }; */ + +static void +build_string_class_template () +{ + tree field_decl, field_decl_chain; + + field_decl = create_builtin_decl (FIELD_DECL, id_type, "isa"); + field_decl_chain = field_decl; + + field_decl = create_builtin_decl (FIELD_DECL, + build_pointer_type (char_type_node), + "cString"); + chainon (field_decl_chain, field_decl); + + field_decl = create_builtin_decl (FIELD_DECL, unsigned_type_node, "length"); + chainon (field_decl_chain, field_decl); + + finish_struct (constant_string_type, field_decl_chain, NULL_TREE); +} + /* Custom build_string which sets TREE_TYPE! */ static tree @@ -1287,7 +1316,12 @@ build_objc_string_object (strings) TREE_SET_CODE (string, STRING_CST); length = TREE_STRING_LENGTH (string) - 1; - /* & ((NXConstantString) {0, string, length}) */ + /* We could not properly create NXConstantString in synth_module_prologue, + because that's called before debugging is initialized. Do it now. */ + if (TYPE_FIELDS (constant_string_type) == NULL_TREE) + build_string_class_template (); + + /* & ((NXConstantString) { NULL, string, length }) */ if (flag_next_runtime) { |