1 // RUN: not %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -DPROTOEXPR -o - 2>&1 \
2 // RUN: | FileCheck -check-prefix=PROTOEXPR %s
4 // RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -DREDUNDANCY -o - \
5 // RUN: | FileCheck -check-prefix=REDUNDANCY1 %s
6 // RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -DREDUNDANCY -o - \
7 // RUN: | FileCheck -check-prefix=REDUNDANCY2 %s
9 // RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -DBASE -o - \
10 // RUN: | FileCheck -check-prefix=NONFRAGILE %s
11 // RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -DINHERITANCE -o - \
12 // RUN: | FileCheck -check-prefix=INHERITANCE %s
14 // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 %s -DBASE -o - \
15 // RUN: | FileCheck -check-prefix=FRAGILE %s
16 // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 %s -DINHERITANCE -o - \
17 // RUN: | FileCheck -check-prefix=FRAGILEINHERITANCE %s
19 // RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu -fobjc-runtime=gnustep %s -DBASE -o - \
20 // RUN: | FileCheck -check-prefix=GNU %s
21 // RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu -fobjc-runtime=gnustep %s -DINHERITANCE -o - \
22 // RUN: | FileCheck -check-prefix=GNUINHERITANCE %s
24 // RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu -fobjc-runtime=gnustep-2 %s -DBASE -o - \
25 // RUN: | FileCheck -check-prefix=GNU2 %s
26 // RUN: %clang_cc1 -emit-llvm -triple x86_64-linux-gnu -fobjc-runtime=gnustep-2 %s -DINHERITANCE -o - \
27 // RUN: | FileCheck -check-prefix=GNU2INHERITANCE %s
29 __attribute__((objc_root_class))
36 // REDUNDANCY1-NOT: _OBJC_CLASS_PROTOCOLS_$_Implementer{{.*}}_OBJC_PROTOCOL_$_B
37 // REDUNDANCY2: _OBJC_CLASS_PROTOCOLS_$_Implementer{{.*}}_OBJC_PROTOCOL_$_C{{.*}}_OBJC_PROTOCOL_$_A
44 __attribute__((objc_non_runtime_protocol)) @protocol Alpha<A>
46 __attribute__((objc_non_runtime_protocol)) @protocol Beta<B>
48 @interface Implementer : Root <Alpha, Beta, C>
50 @implementation Implementer
55 // Confirm that we're not emitting protocol information for the
56 // NONFRAGILE-NOT: OBJC_CLASS_NAME{{.*}}NonRuntimeProtocol
57 // NONFRAGILE-NOT: _OBJC_$_PROTOCOL_INSTANCE_METHODS_NonRuntimeProtocol
58 // NONFRAGILE-NOT: _OBJC_$_PROTOCOL_CLASS_METHODS_NonRuntimeProtocol
59 // NONFRAGILE-NOT: _OBJC_PROTOCOL_$_NonRuntimeProtocol
60 // NONFRAGILE-NOT: _OBJC_LABEL_PROTOCOL_$_NonRuntimeProtocol
61 // NONFRAGILE-NOT: _OBJC_CLASS_PROTOCOLS_$_NonRuntimeImplementer
62 // FRAGILE-NOT: OBJC_CLASS_NAME_.{{.*}}"Runtime\00"
63 // FRAGILE-NOT: OBJC_PROTOCOL_NonRuntime
64 // FRAGILE_NOT: OBJC_PROTOCOLS_NonRuntimeImplementer
65 // GNU-NOT: private unnamed_addr constant {{.*}} c"NonRuntimeProtocol\00"
66 // GNU-NOT: @.objc_protocol {{.*}}
67 // GNU2-NOT: private unnamed_addr constant {{.*}} c"NonRuntimeProtocol\00"
68 // GNU2-NOT: @.objc_protocol {{.*}}
69 __attribute__((objc_non_runtime_protocol))
70 @protocol NonRuntimeProtocol
74 // NONFRAGILE: @"_OBJC_METACLASS_RO_$_NonRuntimeImplementer" {{.*}} %struct._objc_protocol_list* null
75 // NONFRAGILE: @"_OBJC_CLASS_RO_$_NonRuntimeImplementer" {{.*}} %struct._objc_protocol_list* null
76 @interface NonRuntimeImplementer : Root <NonRuntimeProtocol>
81 @implementation NonRuntimeImplementer
84 + (void)doClassThing {
90 __attribute__((objc_non_runtime_protocol))
91 @protocol NonRuntimeProtocol
94 // PROTOEXPR: cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression
95 Protocol *p = @protocol(NonRuntimeProtocol);
100 // Confirm that we only emit references to the non-runtime protocols and
101 // properly walk the DAG to find the right protocols.
102 // INHERITANCE: OBJC_PROTOCOL_$_R2{{.*}}
103 // INHERITANCE: OBJC_PROTOCOL_$_R3{{.*}}
104 // INHERITANCE: @"_OBJC_CLASS_PROTOCOLS_$_Implementer" {{.*}}_OBJC_PROTOCOL_$_R2{{.*}}_OBJC_PROTOCOL_$_R3
106 // FRAGILEINHERITANCE: OBJC_PROTOCOL_R2
107 // FRAGILEINHERITANCE: OBJC_PROTOCOL_R3
108 // FRAGILEINHERITANCE: OBJC_CLASS_PROTOCOLS_Implementer{{.*}}OBJC_PROTOCOL_R2{{.*}}OBJC_PROTOCOL_R3
110 // GNUINHERITANCE-DAG: @[[Proto1:[0-9]]]{{.*}}c"R1\00"
111 // GNUINHERITANCE-DAG: [[P1Name:@.objc_protocol.[0-9]*]]{{.*}}@[[Proto1]]
112 // GNUINHERITANCE-DAG: @[[Proto2:[0-9]]]{{.*}}c"R2\00"
113 // GNUINHERITANCE-DAG: [[P2Name:@.objc_protocol.[0-9]+]]{{.*}}@[[Proto2]]
114 // GNUINHERITANCE-DAG: @[[Proto3:[0-9]]]{{.*}}c"R3\00"
115 // GNUINHERITANCE-DAG: [[P3Name:@.objc_protocol.[0-9]+]]{{.*}}@[[Proto3]]
116 // GNUINHERITANCE-DAG: @.objc_protocol_list{{.*}}
117 // GNUINHERITANCE: @.objc_protocol_list{{.*}}[[Proto3]]{{.*}}[[Proto2]]
119 // GNU2INHERITANCE-DAG: @[[Proto1:[0-9]]]{{.*}}c"R1\00"
120 // GNU2INHERITANCE-DAG: _OBJC_PROTOCOL_R1{{.*}}@[[Proto1]]
121 // GNU2INHERITANCE-DAG: @[[Proto2:[0-9]]]{{.*}}c"R2\00"
122 // GNU2INHERITANCE-DAG: _OBJC_PROTOCOL_R2{{.*}}@[[Proto2]]
123 // GNU2INHERITANCE-DAG: @[[Proto3:[0-9]]]{{.*}}c"R3\00"
124 // GNU2INHERITANCE-DAG: _OBJC_PROTOCOL_R3{{.*}}@[[Proto3]]
125 // GNU2INHERITANCE: @.objc_protocol_list{{.*}}_OBJC_PROTOCOL_R2{{.*}}_OBJC_PROTOCOL_R3
132 __attribute__((objc_non_runtime_protocol)) @protocol N3
134 __attribute__((objc_non_runtime_protocol)) @protocol N1<R3, R2, N3>
136 __attribute__((objc_non_runtime_protocol)) @protocol N2<N1, R2>
138 @interface Implementer : Root <N2, R2>
140 @implementation Implementer