diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-10-16 14:03:42 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-10-16 14:03:42 +0000 |
commit | 1cde73d75d94428876d2924763acd292b2f4b632 (patch) | |
tree | b7ad195618cdca2ff18a0a9236f8926331622f27 /libobjc/class.c | |
parent | 4b0b4ab069cd49638ab3c09d427d00180ce60691 (diff) | |
download | gcc-1cde73d75d94428876d2924763acd292b2f4b632.tar.gz |
class.c (class_getSuperclass): Call __objc_resolve_class_links if the class is not resolved yet.
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.
From-SVN: r165542
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; } |