|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-frontend -emit-module -emit-module-path %t/has_symbol_helper.swiftmodule -parse-as-library %S/Inputs/has_symbol_helper.swift -enable-library-evolution -disable-availability-checking -DCONCURRENCY |
| 3 | +// RUN: %target-swift-frontend -emit-irgen %s -I %t -module-name test | %FileCheck %s |
| 4 | + |
| 5 | +// REQUIRES: concurrency |
| 6 | +// REQUIRES: VENDOR=apple |
| 7 | + |
| 8 | +@_weakLinked import has_symbol_helper |
| 9 | + |
| 10 | +func testGlobalFunctions() { |
| 11 | + if #_hasSymbol(asyncFunc) {} |
| 12 | + // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper9asyncFuncyyYaFTwS"() |
| 13 | + // CHECK: ret i1 and (i1 icmp ne (void (%swift.context*)* @"$s17has_symbol_helper9asyncFuncyyYaF", void (%swift.context*)* null), i1 icmp ne (%swift.async_func_pointer* @"$s17has_symbol_helper9asyncFuncyyYaFTu", %swift.async_func_pointer* null)) |
| 14 | + |
| 15 | + if #_hasSymbol(isolatedFunc) {} |
| 16 | + // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper12isolatedFuncyyFTwS"() |
| 17 | + // CHECK: ret i1 icmp ne (void ()* @"$s17has_symbol_helper12isolatedFuncyyF", void ()* null) |
| 18 | +} |
| 19 | + |
| 20 | +func testActor(_ a: A) { |
| 21 | + if #_hasSymbol(A.init) {} |
| 22 | + // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1ACACycfcTwS"() |
| 23 | + // CHECK: ret i1 and (i1 icmp ne (%T17has_symbol_helper1AC* (%T17has_symbol_helper1AC*)* @"$s17has_symbol_helper1ACACycfc", %T17has_symbol_helper1AC* (%T17has_symbol_helper1AC*)* null), i1 icmp ne (%T17has_symbol_helper1AC* (%swift.type*)* @"$s17has_symbol_helper1ACACycfC", %T17has_symbol_helper1AC* (%swift.type*)* null)) |
| 24 | + |
| 25 | + if #_hasSymbol(a.asyncMethod) {} |
| 26 | + // CHECK: define linkonce_odr hidden swiftcc i1 @"$s17has_symbol_helper1AC11asyncMethodyyYaFTwS"() |
| 27 | + // CHECK: ret i1 and (i1 and (i1 icmp ne (void (%swift.context*, %T17has_symbol_helper1AC*)* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTj", void (%swift.context*, %T17has_symbol_helper1AC*)* null), i1 icmp ne (%swift.async_func_pointer* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTjTu", %swift.async_func_pointer* null)), i1 icmp ne (%swift.method_descriptor* @"$s17has_symbol_helper1AC11asyncMethodyyYaFTq", %swift.method_descriptor* null)) |
| 28 | + |
| 29 | + // FIXME: Add support for actor isolated methods |
| 30 | +} |
0 commit comments