[PATCH] D75574: RFC: Implement objc_direct_protocol attribute to remove protocol metadata

Nathan Lanza via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 16:06:20 PDT 2020


lanza added a comment.

A concern that has come up while rewriting this for the listed concerns is forward declared protocols that are defined as `non_runtime`.

  @protocol NonRuntimeProto;
  
  @interface Implementer : Root <NonRuntimeProto>
  @end
  
  @implementation Implementer
  ...
  @end

This compiles just fine but with a warning in clang 12. It'll emit a reference to the `NonRuntimeProto` without ever having had the chance to see the `objc_non_runtime_protocol` defined elsewhere and will thus error out at link.

There's a few ways to move forward with this:

1. Ignore it. If the user decided that a protocol was `objc_non_runtime_protocol` they probably have the insight necessary to address this link error. This is no more difficult than many C++ linker errors to diagnose.
2. Make it an error if the protocol is not defined prior to the implementation but leave forward-decls as valid for interfaces.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75574/new/

https://reviews.llvm.org/D75574



More information about the cfe-commits mailing list