1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
3 // CHECK: @"_OBJC_$_PROTOCOL_METHOD_TYPES_P1" = internal global
4 // CHECK: @[[PROTO_P1:"_OBJC_PROTOCOL_\$_P1"]] = weak hidden
5 // CHECK: @[[LABEL_PROTO_P1:"_OBJC_LABEL_PROTOCOL_\$_P1"]] = weak hidden global %{{.*}}* @[[PROTO_P1]]
6 // CHECK: @[[PROTO_P2:"_OBJC_PROTOCOL_\$_P2"]] = weak hidden
7 // CHECK: @[[LABEL_PROTO_P2:"_OBJC_LABEL_PROTOCOL_\$_P2"]] = weak hidden global %{{.*}}* @[[PROTO_P2]]
8 // CHECK: @"_OBJC_$_PROTOCOL_REFS_P3" = internal global { i64, [3 x %{{.*}}] } { i64 2, [3 x %{{.*}}*] [%{{.*}}* @[[PROTO_P1]], %{{.*}}* @[[PROTO_P2]], %{{.*}}* null] }
9 // CHECK: @[[PROTO_P3:"_OBJC_PROTOCOL_\$_P3"]] = weak hidden
10 // CHECK: @[[LABEL_PROTO_P3:"_OBJC_LABEL_PROTOCOL_\$_P3"]] = weak hidden global %{{.*}}* @[[PROTO_P3]]
11 // CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P3" = weak hidden global %{{.*}}* bitcast (%{{.*}}* @[[PROTO_P3]] to %{{.*}}*)
12 // CHECK: @[[PROTO_P0:"_OBJC_PROTOCOL_\$_P0"]] = weak hidden
13 // CHECK: @[[LABEL_PROTO_P0:"_OBJC_LABEL_PROTOCOL_\$_P0"]] = weak hidden global %{{.*}}* @[[PROTO_P0]]
14 // CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P0]] to %{{.*}}*)
15 // CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P1" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P1]] to %{{.*}}*)
16 // CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P2" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P2]] to %{{.*}}*)
18 void p(const char*, ...);
22 -(int) conformsTo: (id) x;
29 +(void) classMethodReq0;
32 +(void) classMethodOpt1;
35 +(void) classMethodReq2;
40 //@property(readwrite) int x;
48 void foo(const id a) {
49 void *p = @protocol(P3);
53 Protocol *P0 = @protocol(P0);
54 Protocol *P1 = @protocol(P1);
55 Protocol *P2 = @protocol(P2);
56 Protocol *P3 = @protocol(P3);
58 #define Pbool(X) p(#X ": %s\n", X ? "yes" : "no");
59 Pbool([P0 conformsTo: P1]);
60 Pbool([P1 conformsTo: P0]);
61 Pbool([P1 conformsTo: P2]);
62 Pbool([P2 conformsTo: P1]);
63 Pbool([P3 conformsTo: P1]);
64 Pbool([P1 conformsTo: P3]);
69 // rdar://problem/7992749
70 typedef Root<P1> P1Object;
72 return [P1Object maxValue];