aboutsummaryrefslogtreecommitdiff
path: root/libobjc/class.c
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2011-08-06 09:49:30 +0000
committerNicola Pero <nicola@gcc.gnu.org>2011-08-06 09:49:30 +0000
commit3f54203792c34fc3381c1bcd4fd77ef62c0c377f (patch)
tree1e7b3a8bb4d030cf3d96c14215b779ba1938243f /libobjc/class.c
parentcd7c6bc5bfb1304b12d36972f4e2037555fd2d89 (diff)
In libobjc/: 2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/: 2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com> PR libobjc/49882 * class.c (class_getSuperclass): Return the superclass if the class is in construction. * objc/runtime.h (class_getSuperclass): Updated documentation. In gcc/testsuite/: 2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com> PR libobjc/49882 * objc.dg/gnu-api-2-class.m (main): Test class_getSuperclass() with classes that are in construction. From-SVN: r177505
Diffstat (limited to 'libobjc/class.c')
-rw-r--r--libobjc/class.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libobjc/class.c b/libobjc/class.c
index 3fe3561d2ac..5df70508691 100644
--- a/libobjc/class.c
+++ b/libobjc/class.c
@@ -923,10 +923,13 @@ class_getSuperclass (Class class_)
if (class_ == Nil)
return Nil;
- /* Classes that are in construction are not resolved and can not be
- resolved! */
+ /* Classes that are in construction are not resolved, and still have
+ the class name (instead of a class pointer) in the
+ class_->superclass field. In that case we need to lookup the
+ superclass name to return the superclass. We can not resolve the
+ class until it is registered. */
if (CLS_IS_IN_CONSTRUCTION (class_))
- return Nil;
+ return objc_lookUpClass ((const char *)(class_->super_class));
/* 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