2012-06-20 14:18:46 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-runtime=macosx-fragile-10.5 -o %t %s
|
2008-10-30 06:36:39 +08:00
|
|
|
|
|
|
|
// No object generated
|
2013-07-04 23:22:16 +08:00
|
|
|
// RUN: not grep OBJC_PROTOCOL_P0 %t
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P0;
|
|
|
|
|
|
|
|
// No object generated
|
2013-07-04 23:22:16 +08:00
|
|
|
// RUN: not grep OBJC_PROTOCOL_P1 %t
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P1 -im1; @end
|
|
|
|
|
|
|
|
// Definition triggered by protocol reference.
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep OBJC_PROTOCOL_P2 %t | count 3
|
|
|
|
// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P2 -im1; @end
|
|
|
|
void f0() { id x = @protocol(P2); }
|
|
|
|
|
|
|
|
// Forward definition triggered by protocol reference.
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep OBJC_PROTOCOL_P3 %t | count 3
|
2013-07-04 23:22:16 +08:00
|
|
|
// RUN: not grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P3;
|
2018-08-18 06:18:08 +08:00
|
|
|
@interface UserP3<P3>
|
|
|
|
@end
|
|
|
|
@implementation UserP3
|
|
|
|
@end
|
2008-10-30 06:36:39 +08:00
|
|
|
|
|
|
|
// Definition triggered by class reference.
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep OBJC_PROTOCOL_P4 %t | count 3
|
|
|
|
// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P4 -im1; @end
|
|
|
|
@interface I0<P4> @end
|
2009-07-22 04:50:41 +08:00
|
|
|
@implementation I0 -im1 { return 0; }; @end
|
2008-10-30 06:36:39 +08:00
|
|
|
|
|
|
|
// Definition following forward reference.
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep OBJC_PROTOCOL_P5 %t | count 3
|
|
|
|
// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P5;
|
2018-08-18 06:18:08 +08:00
|
|
|
@interface UserP5<P5> // This generates a forward
|
|
|
|
// reference, which has to be
|
|
|
|
// updated on the next line.
|
|
|
|
@end
|
|
|
|
@protocol P5 -im1; @end
|
|
|
|
@implementation UserP5
|
|
|
|
|
|
|
|
- im1 { }
|
|
|
|
|
|
|
|
@end
|
2008-10-30 06:36:39 +08:00
|
|
|
|
|
|
|
// Protocol reference following definition.
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep OBJC_PROTOCOL_P6 %t | count 4
|
|
|
|
// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3
|
2008-10-30 06:36:39 +08:00
|
|
|
@protocol P6 -im1; @end
|
|
|
|
@interface I1<P6> @end
|
2009-07-22 04:50:41 +08:00
|
|
|
@implementation I1 -im1 { return 0; }; @end
|
2008-10-30 06:36:39 +08:00
|
|
|
void f3() { id x = @protocol(P6); }
|
|
|
|
|