mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The main point of this change is to make sure that a shared function always has a body: both, in the optimizer pipeline and in the swiftmodule file. This is important because the compiler always needs to emit code for a shared function. Shared functions cannot be referenced from outside the module. In several corner cases we missed to maintain this invariant which resulted in unresolved-symbol linker errors. As side-effect of this change we can drop the shared_external SIL linkage and the IsSerializable flag, which simplifies the serialization and linkage concept.
20 lines
845 B
Swift
20 lines
845 B
Swift
// RUN: %empty-directory(%t)
|
|
|
|
// Try serialization of clang-generated functions.
|
|
|
|
// RUN: %target-swift-frontend -parse-as-library -module-name=static_inline -emit-module %S/Inputs/static_inline.swift -enable-objc-interop -import-objc-header %S/Inputs/static_inline.h -o %t/static_inline.swiftmodule
|
|
// RUN: %target-swift-frontend -module-name test -O -emit-sil %s -I %t -enable-objc-interop | %FileCheck %s
|
|
// RUN: %target-swift-frontend -module-name test -O -emit-ir %s -I %t -enable-objc-interop | %FileCheck --check-prefix=CHECK-IR %s
|
|
|
|
// CHECK: sil shared [clang c_inline_func] @c_inline_func : $@convention(c) (Int32) -> Int32
|
|
|
|
// CHECK-IR-LABEL: define{{.*}} i32 @"$s4test6mytest1xs5Int32VAE_tF"(i32 %0)
|
|
// CHECK-IR: = add {{.*}}, 27
|
|
// CHECK-IR: ret
|
|
|
|
import static_inline
|
|
|
|
public func mytest(x: Int32) -> Int32 {
|
|
return testit(x: x)
|
|
}
|