Files
swift-mirror/test/Serialization/index-table-order.sil
Yuta Saito d913e57d84 [Serialization] Serialize Differentiability WT index sorted
When there are sil_property and sil_differentiability_witness at once,
serialized file couldn't be deserialized because it's index table is
serialized un-sortedly but deserializer assumes that contents of table
index are sorted.

This patch fixes the un-sorted serialization and adds test case to
ensure that table index contents can be deserialized
2020-08-07 08:49:26 +09:00

52 lines
1.1 KiB
Plaintext

// RUN: %empty-directory(%t)
// Ensure that serialized sib can be deserialized correctly assuming
// contents of SIL_INDEX_BLOCK are sorted by their ids
// RUN: %target-swift-frontend -emit-sib %s -module-name test -o %t/test.sib
// RUN: %target-swift-frontend -emit-sil %t/test.sib -module-name test
// CHECK-DAG: sil_vtable
// CHECK-DAG: sil_global
// CHECK-DAG: sil_witness_table
// CHECK-DAG: sil_default_witness_table
// CHECK-DAG: sil_property
sil_stage canonical
import Builtin
import Swift
// For SIL_FUNC_NAMES
sil @id : $@convention(thin) (Float) -> Float {
bb0(%0 : $Float):
return %0 : $Float
}
// For SIL_VTABLE_NAMES
class C {}
sil_vtable C {}
// For SIL_GLOBALVAR_NAMES
sil_global @x : $Int
// For SIL_WITNESS_TABLE_NAMES
protocol P1 {}
struct S : P1 {}
sil_witness_table S: P1 module test {}
// For SIL_DEFAULT_WITNESS_TABLE_NAMES
protocol P2 {}
sil_default_witness_table P2 {}
// For SIL_PROPERTY_OFFSETS
struct A {
var a: Int
}
sil_property #A.a ()
// For SIL_DIFFERENTIABILITY_WITNESS_NAMES
sil_differentiability_witness [parameters 0] [results 0] @id : $@convention(thin) (Float) -> Float {}