diff options
author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-16 14:03:42 +0000 |
---|---|---|
committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-16 14:03:42 +0000 |
commit | 63edd4793c007093d00b73c58761ee516004e544 (patch) | |
tree | b7ad195618cdca2ff18a0a9236f8926331622f27 /libobjc/class.c | |
parent | 0a5dd1a5aa5e923702f39d0c25212a65455778e0 (diff) | |
download | gcc-63edd4793c007093d00b73c58761ee516004e544.tar.gz |
2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
* class.c (class_getSuperclass): Call __objc_resolve_class_links
if the class is not resolved yet.
* ivars.c (class_getInstanceVariable): Use class_getSuperclass.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165542 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc/class.c')
-rw-r--r-- | libobjc/class.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libobjc/class.c b/libobjc/class.c index 8c6f989a8e9..71483457e25 100644 --- a/libobjc/class.c +++ b/libobjc/class.c @@ -500,7 +500,7 @@ objc_getClass (const char *name) if (class) return class; - + if (__objc_get_unknown_class_handler) return (*__objc_get_unknown_class_handler) (name); @@ -796,12 +796,24 @@ class_isMetaClass (Class class_) return CLS_ISMETA (class_); } +/* Even inside libobjc it may be worth using class_getSuperclass + instead of accessing class_->super_class directly because it + resolves the class links if needed. If you access + class_->super_class directly, make sure to deal with the situation + where the class is not resolved yet! */ Class class_getSuperclass (Class class_) { if (class_ == Nil) return Nil; + /* If the class is not resolved yet, super_class would point to a + string (the name of the super class) as opposed to the actual + super class. In that case, we need to resolve the class links + before we can return super_class. */ + if (! CLS_ISRESOLV (class_)) + __objc_resolve_class_links (); + return class_->super_class; } |