Files
swift-mirror/test/SIL/printer_include_decls.swift
Erik Eckstein 6a020f8f15 Stabilize and simplify SIL linkage and serialization
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.
2022-03-09 15:28:05 +01:00

54 lines
949 B
Swift

// RUN: rm -f %t.*
// RUN: %target-swift-frontend -emit-sil %s -o %t.sil
// RUN: %FileCheck --input-file=%t.sil %s
// RUN: %target-swift-frontend -Xllvm -parse-serialized-sil -emit-silgen %t.sil -module-name=printer_include_decl | %FileCheck %s
var x: Int
// CHECK: var x: Int
class Foo {
// FIXME: The constructors and destructors without bodies cannot be parsed.
init(i: Int) {
self.x = i
}
// CHECK: init(i: Int)
deinit { m() }
// CHECK: deinit
subscript(x: Int, y: Int) -> Int {
get {
return 0
}
set {}
}
// CHECK: subscript(x: Int, y: Int) -> Int
final var x : Int
// CHECK: var x: Int
final var y : Int {
get {
return 5
}
}
// CHECK: var y: Int
func m() {}
// CHECK: func m()
enum E {}
// CHECK: enum E
}
func bar(x: Foo) -> Int {
return x.x
}
// CHECK: func bar(x: Foo) -> Int
extension Foo.E {
// CHECK: extension Foo.E {
func e(x: Foo.E) {}
// CHECK: func e(x: Foo.E)
}