[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
Thu Aug 16 23:05:13 PDT 2018


rjmccall added inline comments.


================
Comment at: test/CodeGenObjC/forward-declare-protocol-gnu.m:6
 
-Protocol *getProtocol(void)
-{
-	        return @protocol(P);
-}
+ at interface I <P>
+ at end
----------------
arphaman wrote:
> rjmccall wrote:
> > Does this really not require a definition of `P`?  Ugh.  I wonder if that's reasonable to fix, too.
> Nope, we don't emit the protocol metadata for it. It might make sense to require the definition with the implementation?
Yeah, I think so.  I would argue that there no places where we should be emitting metadata for an incomplete protocol.


================
Comment at: test/Parser/objc-cxx-keyword-identifiers.mm:22
+ at protocol P2;
+ at protocol delete // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
+ at end
----------------
arphaman wrote:
> rjmccall wrote:
> > Why did this test need to change?
> We need to declare `delete` because it's used in a `@protocol` expression on line 63.
Ah, gotcha.


Repository:
  rC Clang

https://reviews.llvm.org/D49462





More information about the cfe-commits mailing list