David Chisnall | 404bbcb | 2018-05-22 10:13:06 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s |
| 2 | |
| 3 | @protocol X |
| 4 | @optional |
| 5 | - (id)x; |
| 6 | @required |
| 7 | + (void*)y; |
| 8 | @property int reqProp; |
| 9 | @optional |
| 10 | @property int optProp; |
| 11 | @end |
| 12 | |
| 13 | // Check that we get some plausible-looking method lists. |
| 14 | // CHECK: internal global { i32, i32, [2 x { i8*, i8* }] } { i32 2, i32 16, |
| 15 | // CHECK-SAME: @".objc_selector_reqProp_i16\010:8" |
| 16 | // CHECK-SAME: @".objc_selector_setReqProp:_v20\010:8i16" |
| 17 | // CHECK: internal global { i32, i32, [3 x { i8*, i8* }] } { i32 3, i32 16, |
| 18 | // CHECK-SAME: @".objc_selector_x_\0116\010:8" |
| 19 | // CHECK-SAME: @".objc_selector_optProp_i16\010:8" |
| 20 | // CHECK-SAME: @".objc_selector_setOptProp:_v20\010:8i16" |
| 21 | |
| 22 | |
| 23 | // Check that we're emitting the protocol and a correctly initialised |
| 24 | // indirection variable. |
David Chisnall | 93ce018 | 2018-08-10 12:53:13 +0000 | [diff] [blame] | 25 | // CHECK: @._OBJC_PROTOCOL_X = global |
David Chisnall | 404bbcb | 2018-05-22 10:13:06 +0000 | [diff] [blame] | 26 | // CHECK-SAME: , section "__objc_protocols", comdat, align 8 |
David Chisnall | 93ce018 | 2018-08-10 12:53:13 +0000 | [diff] [blame] | 27 | // CHECK: @._OBJC_REF_PROTOCOL_X = linkonce_odr global |
David Chisnall | 404bbcb | 2018-05-22 10:13:06 +0000 | [diff] [blame] | 28 | // CHECK-SAME: @._OBJC_PROTOCOL_X |
David Chisnall | 93ce018 | 2018-08-10 12:53:13 +0000 | [diff] [blame] | 29 | // CHECK-SAME: , section "__objc_protocol_refs", comdat, align 8 |
David Chisnall | 404bbcb | 2018-05-22 10:13:06 +0000 | [diff] [blame] | 30 | |
| 31 | |
| 32 | // Check that we load from the indirection variable on protocol references. |
| 33 | // CHECK: define i8* @x() |
| 34 | // CHECK: = load |
| 35 | // CHECK-SAME: @._OBJC_REF_PROTOCOL_X, align 8 |
| 36 | void *x() |
| 37 | { |
| 38 | return @protocol(X); |
| 39 | } |