mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
4b0b4ab069
commit
1cde73d75d
|
@ -1,3 +1,9 @@
|
||||||
|
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.
|
||||||
|
|
||||||
2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
|
2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
* objc/runtime.h (class_getIvarLayout): New.
|
* objc/runtime.h (class_getIvarLayout): New.
|
||||||
|
|
|
@ -500,7 +500,7 @@ objc_getClass (const char *name)
|
||||||
|
|
||||||
if (class)
|
if (class)
|
||||||
return class;
|
return class;
|
||||||
|
|
||||||
if (__objc_get_unknown_class_handler)
|
if (__objc_get_unknown_class_handler)
|
||||||
return (*__objc_get_unknown_class_handler) (name);
|
return (*__objc_get_unknown_class_handler) (name);
|
||||||
|
|
||||||
|
@ -796,12 +796,24 @@ class_isMetaClass (Class class_)
|
||||||
return CLS_ISMETA (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
|
||||||
class_getSuperclass (Class class_)
|
class_getSuperclass (Class class_)
|
||||||
{
|
{
|
||||||
if (class_ == Nil)
|
if (class_ == Nil)
|
||||||
return 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;
|
return class_->super_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class_getInstanceVariable (Class class_, const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class_ = class_->super_class;
|
class_ = class_getSuperclass (class_);
|
||||||
}
|
}
|
||||||
objc_mutex_unlock (__objc_runtime_mutex);
|
objc_mutex_unlock (__objc_runtime_mutex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue