|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %swiftc_driver_plain -target x86_64-unknown-windows-msvc -DLIBRARY -module-name Library -emit-library -static -autolink-force-load -module-link-name Library %s -o %t/library.lib -emit-module-path %t |
| 3 | +// RUN: %swiftc_driver_plain -target x86_64-unknown-windows-msvc -DLIBRARY -module-name Library -emit-library -static -autolink-force-load -module-link-name Library %s -S -emit-ir -o - | %FileCheck -check-prefix CHECK-LIBRARY %s |
| 4 | +// RUN: %swiftc_driver_plain -target x86_64-unknown-windows-msvc -I %t -emit-library -S -emit-ir -o - %s | %FileCheck -check-prefix CHECK-EMBEDDING %s |
| 5 | + |
| 6 | +// REQUIRES: OS=windows-msvc |
| 7 | + |
| 8 | +#if LIBRARY |
| 9 | + |
| 10 | +// nominal type descriptor for Library.C |
| 11 | +// CHECK-LIBRARY: @"$s7Library1CCMn" = constant |
| 12 | + |
| 13 | +// nominal type descriptor for Library.S |
| 14 | +// CHECK-LIBRARY: @"$s7Library1SVMn" = constant |
| 15 | + |
| 16 | +// method descriptor for Library.C.method |
| 17 | +// CHECK-LBRARY: @"$s7Library1CC6methodyyFTq" = alias |
| 18 | + |
| 19 | +// type metadata for Library.C |
| 20 | +// CHECK-LIBRARY: @"$s7Library1CCN" = alias |
| 21 | + |
| 22 | +// type metadata for Library.S |
| 23 | +// CHECK-LIBRARY: @"$s7Library1SVN" = alias |
| 24 | + |
| 25 | +public func f() { |
| 26 | +} |
| 27 | + |
| 28 | +// Library.f() -> () |
| 29 | +// CHECK-LIBRARY: define swiftcc void @"$s7Library1fyyF"() |
| 30 | + |
| 31 | +open class C { |
| 32 | + var property: () -> () { |
| 33 | + return f |
| 34 | + } |
| 35 | + |
| 36 | + open func method() { |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +// Library.C.method() -> () |
| 41 | +// CHECK-LIBRARY: define swiftcc void @"$s7Library1CC6methodyyF"(%T7Library1CC* swiftself %0) |
| 42 | + |
| 43 | +// Library.C.deinit |
| 44 | +// CHECK-LIBRARY: define swiftcc %swift.refcounted* @"$s7Library1CCfd"(%T7Library1CC* swiftself %0) |
| 45 | + |
| 46 | +// Library.C.__deallocating_deinit |
| 47 | +// CHECK-LIBRARY: define swiftcc void @"$s7Library1CCfD"(%T7Library1CC* swiftself %0) |
| 48 | + |
| 49 | +// Library.C.__allocating_init() -> Library.C |
| 50 | +// CHECK-LIBRARY: define swiftcc %T7Library1CC* @"$s7Library1CCACycfC"(%swift.type* swiftself %0) |
| 51 | + |
| 52 | +public struct S { |
| 53 | + var member: () -> Void = f |
| 54 | +} |
| 55 | + |
| 56 | +// variable initialization expression of Library.S.member : () -> () |
| 57 | +// CHECK-LIBRARY: define swiftcc { i8*, %swift.refcounted* } @"$s7Library1SV6memberyycvpfi"() |
| 58 | + |
| 59 | +// type metadata accessor for Library.C |
| 60 | +// CHECK-LIBRARY: define swiftcc %swift.metadata_response @"$s7Library1CCMa"(i64 %0) |
| 61 | + |
| 62 | +// type metadata accessor for Library.S |
| 63 | +// CHECK-LIBRARY: define swiftcc %swift.metadata_response @"$s7Library1SVMa"(i64 %0) |
| 64 | + |
| 65 | +// CHECK-LIBRARY: define internal void @"_swift_FORCE_LOAD_$_Library"() |
| 66 | + |
| 67 | +#else |
| 68 | +import Library |
| 69 | +func f() { |
| 70 | + Library.f() |
| 71 | +} |
| 72 | + |
| 73 | +// CHECK-EMBEDDING-NOT: @"_swift_FORCE_LOAD_$_Library" |
| 74 | + |
| 75 | +#endif |
| 76 | + |
0 commit comments