r199480 - Add more test cases for attribute 'objc_protocol_requires_explicit_implementation'.
Ted Kremenek
kremenek at apple.com
Fri Jan 17 00:34:19 PST 2014
Author: kremenek
Date: Fri Jan 17 02:34:19 2014
New Revision: 199480
URL: http://llvm.org/viewvc/llvm-project?rev=199480&view=rev
Log:
Add more test cases for attribute 'objc_protocol_requires_explicit_implementation'.
Modified:
cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m
Modified: cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m?rev=199480&r1=199479&r2=199480&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m (original)
+++ cfe/trunk/test/SemaObjC/protocols-suppress-conformance.m Fri Jan 17 02:34:19 2014
@@ -59,14 +59,21 @@ int x;
__attribute__((objc_protocol_requires_explicit_implementation))
@protocol ProtocolA
@required
-- (void)rlyeh;
-- (void)innsmouth;
+- (void)rlyeh; // expected-note 2 {{method 'rlyeh' declared here}}
+- (void)innsmouth; // expected-note 2 {{method 'innsmouth' declared here}}
@end
@protocol ProtocolB <ProtocolA>
@required
- (void)dunwich;
-- (id)innsmouth;
+- (void)innsmouth; // expected-note {{method 'innsmouth' declared here}}
+ at end
+
+__attribute__((objc_protocol_requires_explicit_implementation))
+ at protocol ProtocolB_Explicit <ProtocolA>
+ at required
+- (void)dunwich;
+- (void)innsmouth; // expected-note 2 {{method 'innsmouth' declared here}}
@end
@protocol ProtocolC
@@ -76,14 +83,24 @@ __attribute__((objc_protocol_requires_ex
- (void)dunwich;
@end
- at interface MyObject <ProtocolC>
- at end
+ at interface MyObject <ProtocolC> @end
- at interface MyLovecraft <ProtocolA>
- at end
+// Provide two variants of a base class, one that adopts ProtocolA and
+// one that does not.
+ at interface Lovecraft <ProtocolA> @end
+ at interface Lovecraft_2 @end
+
+// Provide two variants of a subclass that conform to ProtocolB. One
+// subclasses from a class that conforms to ProtocolA, the other that
+// does not.
+//
+// From those, provide two variants that conformat to ProtocolB_Explicit
+// instead.
+ at interface Shoggoth : Lovecraft <ProtocolB> @end
+ at interface Shoggoth_2 : Lovecraft_2 <ProtocolB> @end
+ at interface Shoggoth_Explicit : Lovecraft <ProtocolB_Explicit> @end
+ at interface Shoggoth_2_Explicit : Lovecraft_2 <ProtocolB_Explicit> @end
- at interface MyShoggoth : MyLovecraft <ProtocolB>
- at end
@implementation MyObject
- (void)innsmouth {}
@@ -91,12 +108,28 @@ __attribute__((objc_protocol_requires_ex
- (void)dunwich {}
@end
- at implementation MyLovecraft
+ at implementation Lovecraft
- (void)innsmouth {}
- (void)rlyeh {}
@end
- at implementation MyShoggoth
+ at implementation Shoggoth
+- (void)dunwich {}
+ at end
+
+ at implementation Shoggoth_2 // expected-warning {{method 'innsmouth' in protocol 'ProtocolB' not implemented}}\
+ // expected-warning {{method 'rlyeh' in protocol 'ProtocolA' not implemented}}\
+ // expected-warning {{'innsmouth' in protocol 'ProtocolA' not implemented}}
+- (void)dunwich {}
+ at end
+
+ at implementation Shoggoth_Explicit // expected-warning {{method 'innsmouth' in protocol 'ProtocolB_Explicit' not implemented}}
+- (void)dunwich {}
+ at end
+
+ at implementation Shoggoth_2_Explicit // expected-warning {{method 'innsmouth' in protocol 'ProtocolB_Explicit' not implemented}}\
+ // expected-warning {{method 'rlyeh' in protocol 'ProtocolA' not implemented}}\
+ // expected-warning {{method 'innsmouth' in protocol 'ProtocolA' not implemented}}
- (void)dunwich {}
@end
More information about the cfe-commits
mailing list