diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 19:29:43 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 19:29:43 +0000 |
commit | 46dfcc3ee85a4a02abce4d45ee619f240c116af6 (patch) | |
tree | 6c3dc3d53cd17d62447673b81abbcfc69bacd2f3 /libobjc | |
parent | 2a8624373adc103f943e22e781c2d6fadb828eae (diff) | |
download | gcc-46dfcc3ee85a4a02abce4d45ee619f240c116af6.tar.gz |
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 178073 using svnmerge.
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
* gcc/melt-runtime.c (melt_linemap_compute_current_location): Use the
linemap_position_for_column function for GCC 4.7 when merging with
GCC trunk rev 178073.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@178087 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 28 | ||||
-rw-r--r-- | libobjc/Makefile.in | 1 | ||||
-rw-r--r-- | libobjc/class.c | 76 | ||||
-rw-r--r-- | libobjc/objc/runtime.h | 8 |
4 files changed, 86 insertions, 27 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 45f04859578..b9f87fabec9 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,31 @@ +2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com> + + PR libobjc/50002 + * class.c (__objc_update_classes_with_methods): Iterate over meta + classes as well as normal classes when refreshing the method + implementations. This fixes replacing class methods. + +2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com> + + * class.c (class_getSuperclass): Fixed to work with meta classes + still in construction too. + +2011-08-06 Nicola Pero <nicola.pero@meta-innovation.com> + + * class.c (class_getSuperclass): Fixed typo in comment. + +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. + +2011-08-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * Makefile.in (INCLUDES): Search + $(srcdir)/$(MULTISRCTOP)../libgcc. + 2011-06-08 Nicola Pero <nicola.pero@meta-innovation.com> * objc/objc.h (__GNU_LIBOBJC__): Bumped to 20110608. diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in index 02443327058..0935ccd98d6 100644 --- a/libobjc/Makefile.in +++ b/libobjc/Makefile.in @@ -101,6 +101,7 @@ OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags) INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \ -I$(srcdir)/$(MULTISRCTOP)../gcc/config \ -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \ + -I$(srcdir)/$(MULTISRCTOP)../libgcc \ -I$(srcdir)/$(MULTISRCTOP)../include \ $(OBJC_BOEHM_GC_INCLUDES) diff --git a/libobjc/class.c b/libobjc/class.c index 3fe3561d2ac..edc56aa9ec4 100644 --- a/libobjc/class.c +++ b/libobjc/class.c @@ -781,35 +781,57 @@ __objc_update_classes_with_methods (struct objc_method *method_a, struct objc_me while (node != NULL) { - /* Iterate over all methods in the class. */ - Class class = node->pointer; - struct objc_method_list * method_list = class->methods; - - while (method_list) + /* We execute this loop twice: the first time, we iterate + over all methods in the class (instance methods), while + the second time we iterate over all methods in the meta + class (class methods). */ + Class class = Nil; + BOOL done = NO; + + while (done == NO) { - int i; + struct objc_method_list * method_list; - for (i = 0; i < method_list->method_count; ++i) + if (class == Nil) { - struct objc_method *method = &method_list->method_list[i]; + /* The first time, we work on the class. */ + class = node->pointer; + } + else + { + /* The second time, we work on the meta class. */ + class = class->class_pointer; + done = YES; + } - /* If the method is one of the ones we are looking - for, update the implementation. */ - if (method == method_a) - sarray_at_put_safe (class->dtable, - (sidx) method_a->method_name->sel_id, - method_a->method_imp); + method_list = class->methods; - if (method == method_b) + while (method_list) + { + int i; + + for (i = 0; i < method_list->method_count; ++i) { - if (method_b != NULL) + struct objc_method *method = &method_list->method_list[i]; + + /* If the method is one of the ones we are + looking for, update the implementation. */ + if (method == method_a) sarray_at_put_safe (class->dtable, - (sidx) method_b->method_name->sel_id, - method_b->method_imp); + (sidx) method_a->method_name->sel_id, + method_a->method_imp); + + if (method == method_b) + { + if (method_b != NULL) + sarray_at_put_safe (class->dtable, + (sidx) method_b->method_name->sel_id, + method_b->method_imp); + } } + + method_list = method_list->method_next; } - - method_list = method_list->method_next; } node = node->next; } @@ -923,10 +945,18 @@ 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_->super_class 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; + { + if (CLS_ISMETA (class_)) + return object_getClass ((id)objc_lookUpClass ((const char *)(class_->super_class))); + else + 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 diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h index ab9926e9b6d..c649e239d9e 100644 --- a/libobjc/objc/runtime.h +++ b/libobjc/objc/runtime.h @@ -497,10 +497,10 @@ objc_EXPORT const char * class_getName (Class class_); objc_EXPORT BOOL class_isMetaClass (Class class_); /* Return the superclass of 'class_'. If 'class_' is Nil, or it is a - root class, return Nil. If 'class_' is a class being constructed, - that is, a class returned by objc_allocateClassPair() but before it - has been registered with the runtime using - objc_registerClassPair(), return Nil. */ + root class, return Nil. This function also works if 'class_' is a + class being constructed, that is, a class returned by + objc_allocateClassPair() but before it has been registered with the + runtime using objc_registerClassPair(). */ objc_EXPORT Class class_getSuperclass (Class class_); /* Return the 'version' number of the class, which is an integer that |