On Dec 3, 2013, at 1:21 PM, Jordan Rose <[email protected]> wrote:
> > On Dec 3, 2013, at 13:11, Argyrios Kyrtzidis <[email protected]> wrote: > >> +void ObjCInterfaceDecl::getDesignatedInitializers( >> + llvm::SmallVectorImpl<const ObjCMethodDecl *> &Methods) const { >> + assert(hasDefinition()); >> + if (data().ExternallyCompleted) >> + LoadExternalDefinition(); >> + >> + const ObjCInterfaceDecl *IFace = this; >> + while (IFace) { >> + if (IFace->data().HasDesignatedInitializers) >> + break; >> + IFace = IFace->getSuperClass(); >> + } >> + >> + if (!IFace) >> + return; >> + for (instmeth_iterator I = IFace->instmeth_begin(), >> + E = IFace->instmeth_end(); I != E; ++I) { >> + const ObjCMethodDecl *MD = *I; >> + if (MD->getMethodFamily() == OMF_init && >> + MD->hasAttr<ObjCDesignatedInitializerAttr>()) >> + Methods.push_back(MD); >> + } >> +} > > Is this correct? This says that even if I declare new init methods (and don't > mark any as designated), the designated initializers are still my > superclass's designated initializers. I think this is a > backwards-compatibility problem for people shipping subclasses with new init > methods. Thanks for pointing out the issue! With r196476, if an interface has no initializer marked as designated and introduces at least one new initializer, we don't assume that it inherits the designated initializers from the super class. We assume that it inherits if it doesn't declare any initializer or if all the declared initializers are overrides from the superclass.
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
