1// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-runtime=macosx-fragile-10.5 -o %t %s 2 3// No object generated 4// RUN: not grep OBJC_PROTOCOL_P0 %t 5@protocol P0; 6 7// No object generated 8// RUN: not grep OBJC_PROTOCOL_P1 %t 9@protocol P1 -im1; @end 10 11// Definition triggered by protocol reference. 12// RUN: grep OBJC_PROTOCOL_P2 %t | count 3 13// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P2 %t | count 3 14@protocol P2 -im1; @end 15void f0() { id x = @protocol(P2); } 16 17// Forward definition triggered by protocol reference. 18// RUN: grep OBJC_PROTOCOL_P3 %t | count 3 19// RUN: not grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t 20@protocol P3; 21void f1() { id x = @protocol(P3); } 22 23// Definition triggered by class reference. 24// RUN: grep OBJC_PROTOCOL_P4 %t | count 3 25// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3 26@protocol P4 -im1; @end 27@interface I0<P4> @end 28@implementation I0 -im1 { return 0; }; @end 29 30// Definition following forward reference. 31// RUN: grep OBJC_PROTOCOL_P5 %t | count 3 32// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P5 %t | count 3 33@protocol P5; 34void f2() { id x = @protocol(P5); } // This generates a forward 35 // reference, which has to be 36 // updated on the next line. 37@protocol P5 -im1; @end 38 39// Protocol reference following definition. 40// RUN: grep OBJC_PROTOCOL_P6 %t | count 4 41// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3 42@protocol P6 -im1; @end 43@interface I1<P6> @end 44@implementation I1 -im1 { return 0; }; @end 45void f3() { id x = @protocol(P6); } 46 47