Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGenObjC/protocols.m @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s | |
2 | |
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 %{{.*}}*) | |
17 | |
18 void p(const char*, ...); | |
19 | |
20 @interface Root | |
21 +(int) maxValue; | |
22 -(int) conformsTo: (id) x; | |
23 @end | |
24 | |
25 @protocol P0 | |
26 @end | |
27 | |
28 @protocol P1 | |
29 +(void) classMethodReq0; | |
30 -(void) methodReq0; | |
31 @optional | |
32 +(void) classMethodOpt1; | |
33 -(void) methodOpt1; | |
34 @required | |
35 +(void) classMethodReq2; | |
36 -(void) methodReq2; | |
37 @end | |
38 | |
39 @protocol P2 | |
40 //@property(readwrite) int x; | |
41 @end | |
42 | |
43 @protocol P3<P1, P2> | |
44 -(id <P1>) print0; | |
45 -(void) print1; | |
46 @end | |
47 | |
48 void foo(const id a) { | |
49 void *p = @protocol(P3); | |
50 } | |
51 | |
52 int main() { | |
53 Protocol *P0 = @protocol(P0); | |
54 Protocol *P1 = @protocol(P1); | |
55 Protocol *P2 = @protocol(P2); | |
56 Protocol *P3 = @protocol(P3); | |
57 | |
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]); | |
65 | |
66 return 0; | |
67 } | |
68 | |
69 // rdar://problem/7992749 | |
70 typedef Root<P1> P1Object; | |
71 int test10() { | |
72 return [P1Object maxValue]; | |
73 } |