Files
swift-mirror/test/SILOptimizer/dead_func_init_method.sil
Joe Groff 8538a2afcc SIL: Verify kinds of vtable entries.
Validate that inherited entries are not left at "normal" state, and that non-overridden entries do not in fact have
overrides.
2020-06-03 16:29:44 -07:00

48 lines
1.1 KiB
Plaintext

// RUN: %target-sil-opt -sil-deadfuncelim %s | %FileCheck %s
// Check that we don't crash on this.
sil_stage canonical
import Builtin
import Swift
import SwiftShims
private class Base {
init()
}
private class Derived : Base {
}
sil private @BaseInit : $@convention(method) (@thick Base.Type) -> @owned Base {
bb0(%4 : $@thick Base.Type):
return undef : $Base
}
sil private @DerivedInit : $@convention(method) (@thick Derived.Type) -> @owned Derived {
bb0(%4 : $@thick Derived.Type):
return undef : $Derived
}
sil @testit : $@convention(method) (@thick Derived.Type) -> @thick Derived.Type {
bb0(%1 : $@thick Derived.Type):
%157 = class_method %1 : $@thick Derived.Type, #Derived.init!allocator : (Derived.Type) -> () -> Derived, $@convention(method) (@thick Derived.Type) -> @owned Derived
return %1 : $@thick Derived.Type
}
sil_vtable Base {
#Base.init!allocator: @BaseInit
}
sil_vtable Derived {
#Base.init!allocator: @DerivedInit [override]
}
// CHECK-LABEL: sil_vtable Base
// CHECK-: BaseInit
// CHECK-LABEL: sil_vtable Derived
// CHECK: DerivedInit