mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This adjusts the runtime function declaration handling to track the owning module for the well known functions. This allows us to ensure that we are able to properly identify if the symbol should be imported or not when building the shared libraries. This will require a subsequent tweak to allow for checking for static library linkage to ensure that we do not mark the symbol as DLLImport when doing static linking.
52 lines
1.9 KiB
Swift
52 lines
1.9 KiB
Swift
// RUN: %swift -Xllvm -sil-disable-pass=GenericSpecializer -target %host_triple -emit-ir -parse-as-library -disable-legacy-type-info -module-name dllimport %s -o - -enable-source-import -I %S | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-NO-OPT
|
|
// RUN: %swift -Xllvm -sil-disable-pass=GenericSpecializer -target %host_triple -O -emit-ir -parse-as-library -disable-legacy-type-info -module-name dllimport -primary-file %s -o - -enable-source-import -I %S | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-OPT
|
|
|
|
// REQUIRES: OS=windows-msvc
|
|
|
|
import dllexport
|
|
|
|
public func get_ci() -> dllexport.c {
|
|
return dllexport.ci
|
|
}
|
|
|
|
public func get_c_type() -> dllexport.c.Type {
|
|
return dllexport.c.self
|
|
}
|
|
|
|
public class d : c {
|
|
override init() {
|
|
super.init()
|
|
}
|
|
|
|
@inline(never)
|
|
func f(_ : dllexport.c) { }
|
|
}
|
|
|
|
struct s : p {
|
|
func f() { }
|
|
}
|
|
|
|
func f(di : d) {
|
|
di.f(get_ci())
|
|
}
|
|
|
|
func blackhole<F>(_ : F) { }
|
|
|
|
public func g() {
|
|
blackhole({ () -> () in })
|
|
}
|
|
|
|
// CHECK-NO-OPT-DAG: declare dllimport ptr @swift_allocObject(ptr, i64, i64)
|
|
// CHECK-NO-OPT-DAG: declare dllimport void @swift_release(ptr)
|
|
// CHECK-NO-OPT-DAG: declare dllimport ptr @swift_retain(ptr returned)
|
|
// CHECK-NO-OPT-DAG: @"$s9dllexport1pMp" = external dllimport global %swift.protocol
|
|
// CHECK-NO-OPT-DAG: declare dllimport swiftcc ptr @"$s9dllexport2ciAA1cCvau"()
|
|
// CHECK-NO-OPT-DAG: declare dllimport swiftcc ptr @"$s9dllexport1cCfd"(ptr swiftself)
|
|
// CHECK-NO-OPT-DAG: declare dllimport void @swift_deallocClassInstance(ptr, i64, i64)
|
|
|
|
// CHECK-OPT-DAG: declare dllimport ptr @swift_retain(ptr returned) local_unnamed_addr
|
|
// CHECK-OPT-DAG: @"\01__imp_{{_?}}$s9dllexport1pMp" = external externally_initialized constant ptr
|
|
// CHECK-OPT-DAG: declare dllimport swiftcc ptr @"$s9dllexport2ciAA1cCvau"()
|
|
// CHECK-OPT-DAG: declare dllimport void @swift_deallocClassInstance(ptr, i64, i64)
|
|
// CHECK-OPT-DAG: declare dllimport swiftcc ptr @"$s9dllexport1cCfd"(ptr swiftself)
|