r196315 - [objc] Introduce ObjCInterfaceDecl::getDesignatedInitializers() to get the

Jordan Rose jordan_rose at apple.com
Tue Dec 3 13:21:25 PST 2013


On Dec 3, 2013, at 13:11, Argyrios Kyrtzidis <akyrtzi at gmail.com> 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.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131203/1b6b50bb/attachment.html>


More information about the cfe-commits mailing list