summaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-14 12:12:55 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-14 12:12:55 +0000
commit29d7200db1f331ccc81e86252185b4ce06412586 (patch)
tree1e8730dabd24d0ca6758eaeae0275a3d21c2eb2d /gcc/objc
parent0c883ef3de95b2304dcc490559cf646ff927d225 (diff)
downloadgcc-29d7200db1f331ccc81e86252185b4ce06412586.tar.gz
In gcc/:
2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_class_declaration): Updated call to objc_declare_class. In gcc/c-family/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * stub-objc.c (objc_declare_class): Updated argument name. In gcc/cp/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_class_declaration): Updated for change in objc_declare_class(). In gcc/objc/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_declare_class): Changed to take a single identifier as argument instead of a tree list. This means callers don't have to build temporary tree lists to call this function. (synth_module_prologue): Updated calls to objc_declare_class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172425 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog7
-rw-r--r--gcc/objc/objc-act.c58
2 files changed, 33 insertions, 32 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index c2f67694cff..f39cb0a582c 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-act.c (objc_declare_class): Changed to take a single
+ identifier as argument instead of a tree list. This means callers
+ don't have to build temporary tree lists to call this function.
+ (synth_module_prologue): Updated calls to objc_declare_class.
+
2011-04-13 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (build_keyword_selector): Use get_identifier_with_length
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 419462131af..c68f628466c 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -2953,7 +2953,7 @@ synth_module_prologue (void)
/* Forward-declare '@interface Protocol'. */
type = get_identifier (PROTOCOL_OBJECT_CLASS_NAME);
- objc_declare_class (tree_cons (NULL_TREE, type, NULL_TREE));
+ objc_declare_class (type);
objc_protocol_type = build_pointer_type (xref_tag (RECORD_TYPE, type));
/* Declare receiver type used for dispatching messages to 'super'. */
@@ -2985,7 +2985,7 @@ synth_module_prologue (void)
if (!constant_string_class_name)
constant_string_class_name = runtime.default_constant_string_class_name;
constant_string_id = get_identifier (constant_string_class_name);
- objc_declare_class (tree_cons (NULL_TREE, constant_string_id, NULL_TREE));
+ objc_declare_class (constant_string_id);
/* Pre-build the following entities - for speed/convenience. */
self_id = get_identifier ("self");
@@ -3360,48 +3360,42 @@ objc_declare_alias (tree alias_ident, tree class_ident)
}
void
-objc_declare_class (tree ident_list)
+objc_declare_class (tree identifier)
{
- tree list;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
- for (list = ident_list; list; list = TREE_CHAIN (list))
+ if (! objc_is_class_name (identifier))
{
- tree ident = TREE_VALUE (list);
-
- if (! objc_is_class_name (ident))
+ tree record = lookup_name (identifier), type = record;
+
+ if (record)
{
- tree record = lookup_name (ident), type = record;
-
- if (record)
+ if (TREE_CODE (record) == TYPE_DECL)
+ type = DECL_ORIGINAL_TYPE (record)
+ ? DECL_ORIGINAL_TYPE (record)
+ : TREE_TYPE (record);
+
+ if (!TYPE_HAS_OBJC_INFO (type)
+ || !TYPE_OBJC_INTERFACE (type))
{
- if (TREE_CODE (record) == TYPE_DECL)
- type = DECL_ORIGINAL_TYPE (record)
- ? DECL_ORIGINAL_TYPE (record)
- : TREE_TYPE (record);
-
- if (!TYPE_HAS_OBJC_INFO (type)
- || !TYPE_OBJC_INTERFACE (type))
- {
- error ("%qE redeclared as different kind of symbol",
- ident);
- error ("previous declaration of %q+D",
- record);
- }
+ error ("%qE redeclared as different kind of symbol",
+ identifier);
+ error ("previous declaration of %q+D",
+ record);
}
-
- record = xref_tag (RECORD_TYPE, ident);
- INIT_TYPE_OBJC_INFO (record);
- /* In the case of a @class declaration, we store the ident
- in the TYPE_OBJC_INTERFACE. If later an @interface is
- found, we'll replace the ident with the interface. */
- TYPE_OBJC_INTERFACE (record) = ident;
- hash_class_name_enter (cls_name_hash_list, ident, NULL_TREE);
}
+
+ record = xref_tag (RECORD_TYPE, identifier);
+ INIT_TYPE_OBJC_INFO (record);
+ /* In the case of a @class declaration, we store the ident in
+ the TYPE_OBJC_INTERFACE. If later an @interface is found,
+ we'll replace the ident with the interface. */
+ TYPE_OBJC_INTERFACE (record) = identifier;
+ hash_class_name_enter (cls_name_hash_list, identifier, NULL_TREE);
}
}