summaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-15 21:46:00 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-15 21:46:00 +0000
commitcfc77d337c39a8d81e819960a63e010f0336cb40 (patch)
treef27b0db0826471d2887a2155ac66dae475397f53 /gcc/objc
parent0836354afffd5f75a71a84d0a4a2d0fb7ba0f2a6 (diff)
downloadgcc-cfc77d337c39a8d81e819960a63e010f0336cb40.tar.gz
In gcc/objc/:
2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (ivar_of_class): New. (objc_is_public): Use ivar_of_class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172523 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog5
-rw-r--r--gcc/objc/objc-act.c31
2 files changed, 35 insertions, 1 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 9698eee1248..f21a2137292 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,5 +1,10 @@
2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com>
+ * objc-act.c (ivar_of_class): New.
+ (objc_is_public): Use ivar_of_class.
+
+2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com>
+
* objc-act.c (objc_get_interface_ivars): Removed.
(objc_detect_field_duplicates): New.
(hash_instance_variable): New.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index ff4045379dd..b48f1795046 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -6367,6 +6367,35 @@ is_private (tree decl)
DECL_NAME (decl)));
}
+/* Searches all the instance variables of 'klass' and of its
+ superclasses for an instance variable whose name (identifier) is
+ 'ivar_name_ident'. Return the declaration (DECL) of the instance
+ variable, if found, or NULL_TREE, if not found. */
+static inline tree
+ivar_of_class (tree klass, tree ivar_name_ident)
+{
+ /* First, look up the ivar in CLASS_RAW_IVARS. */
+ tree decl_chain = CLASS_RAW_IVARS (klass);
+
+ for ( ; decl_chain; decl_chain = DECL_CHAIN (decl_chain))
+ if (DECL_NAME (decl_chain) == ivar_name_ident)
+ return decl_chain;
+
+ /* If not found, search up the class hierarchy. */
+ while (CLASS_SUPER_NAME (klass))
+ {
+ klass = lookup_interface (CLASS_SUPER_NAME (klass));
+
+ decl_chain = CLASS_RAW_IVARS (klass);
+
+ for ( ; decl_chain; decl_chain = DECL_CHAIN (decl_chain))
+ if (DECL_NAME (decl_chain) == ivar_name_ident)
+ return decl_chain;
+ }
+
+ return NULL_TREE;
+}
+
/* We have an instance variable reference;, check to see if it is public. */
int
@@ -6397,7 +6426,7 @@ objc_is_public (tree expr, tree identifier)
return 0;
}
- if ((decl = is_ivar (get_class_ivars (klass, true), identifier)))
+ if ((decl = ivar_of_class (klass, identifier)))
{
if (TREE_PUBLIC (decl))
return 1;