[PATCH] D49462: [ObjC] Error out when using forward-declared protocol in a @protocol expression
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 17 12:59:47 PDT 2018
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.
LGTM.
================
Comment at: lib/CodeGen/CGObjCMac.cpp:6788
+ "emitting protocol metadata without definition");
+ PD = PD->getDefinition();
----------------
arphaman wrote:
> rjmccall wrote:
> > What happens in the `@implementation` case (the one that we're not diagnosing yet) when the protocol is a forward declaration?
> We emit an `external global` reference to the protocol metadata using `GetOrEmitProtocolRef`, so this assertion won't be triggered until we force the emission of protocol metadata from implementation as planned in a follow-up patch.
Okay. I mean, that's also unfortunate behavior, since protocol descriptors are basically `linkonce` and should be emitted in every translation unit that uses them, but I agree it's less damaging than the behavior for `@protocol`, and it means this assertion is safe.
Repository:
rC Clang
https://reviews.llvm.org/D49462
More information about the cfe-commits
mailing list