Files
swift-mirror/test/SIL/Serialization/vtable_deserialization.swift
Slava Pestov 8fe8b89b0f SIL: Terminology change: [fragile] => [serialized]
Also, add a third [serializable] state for functions whose bodies we
*can* serialize, but only do so if they're referenced from another
serialized function.

This will be used for bodies synthesized for imported definitions,
such as init(rawValue:), etc, and various thunks, but for now this
change is NFC.
2017-03-29 16:47:28 -07:00

32 lines
959 B
Swift

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %target-swift-frontend %S/Inputs/vtable_deserialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all
// RUN: %target-swift-frontend %s -emit-sil -O -I %t -o - | %FileCheck %s
import Swift
func WhatShouldIDoImBored<T : P>(_ t : T) {
t.doSomething()
}
@inline(__always)
func MakeItNotAGlobal() -> Y {
let x = Y()
WhatShouldIDoImBored(x)
return x
}
// Make sure all abstractions have been removed and everything inlined into top_level_method.
// CHECK-LABEL: sil @main
// CHECK: bb0({{.*}}):
// CHECK: [[UNKNOWN:%.*]] = function_ref @unknown
// CHECK: apply [[UNKNOWN]]
// CHECK: integer_literal
// CHECK: return
MakeItNotAGlobal()
// Make sure our vtable/witness tables are properly deserialized.
// CHECK: sil_vtable Y {
// CHECK: sil_witness_table public_external [serialized] Y: P module Swift {