Files
swift-mirror/test/IRGen/exactcast2.sil
Nate Chandler e5d87f75a8 [SIL] Add source formal type to checked_cast_br.
It is necessary for opaque values where for casts that will newly start
out as checked_cast_brs and be lowered to checked_cast_addr_brs, since
the latter has the source formal type, IRGen relies on being able to
access it, and there's no way in general to obtain the source formal
type from the source lowered type.
2023-07-27 15:04:15 -07:00

62 lines
2.1 KiB
Plaintext

// RUN: %target-build-swift %s -emit-ir -o -
// REQUIRES: executable_test
// Make sure we are not crashing here.
sil_stage canonical
import Builtin
import Swift
import SwiftShims
class Hash {
init()
func update()
func hash()
deinit
}
final class MD5 : Hash {
override init()
deinit
}
sil @_TFC4main4HashcfMS0_FT_S0_ : $@convention(method) (@owned Hash) -> @owned Hash
sil @_TFC4main4HashCfMS0_FT_S0_ : $@convention(thin) (@thick Hash.Type) -> @owned Hash
sil @_TFC4main4Hash6updatefS0_FT_T_ : $@convention(method) (@guaranteed Hash) -> () {
bb0(%0 : $Hash):
%1 = class_method %0 : $Hash, #Hash.hash : (Hash) -> () -> (), $@convention(method) (@guaranteed Hash) -> () // user: %9
checked_cast_br [exact] Hash in %0 : $Hash to MD5, bb2, bb3 // id: %2
bb1: // Preds: bb2 bb3
%3 = tuple () // user: %4
return %3 : $() // id: %4
bb2(%5 : $MD5): // Preds: bb0
br bb1 // id: %8
bb3: // Preds: bb0
%9 = apply %1(%0) : $@convention(method) (@guaranteed Hash) -> ()
br bb1 // id: %10
}
sil @_TFC4main4Hash4hashfS0_FT_T_ : $@convention(method) (@guaranteed Hash) -> ()
sil @_TFC4main3MD5cfMS0_FT_S0_ : $@convention(method) (@owned MD5) -> @owned MD5
sil @_TFC4main3MD5CfMS0_FT_S0_ : $@convention(thin) (@thick MD5.Type) -> @owned MD5
sil_vtable Hash {
#Hash.init!initializer: @_TFC4main4HashcfMS0_FT_S0_ // main.Hash.init (main.Hash.Type)() -> main.Hash
#Hash.update: @_TFC4main4Hash6updatefS0_FT_T_ // main.Hash.update (main.Hash)() -> ()
#Hash.hash: @_TFC4main4Hash4hashfS0_FT_T_ // main.Hash.hash (main.Hash)() -> ()
}
sil_vtable MD5 {
#Hash.init!initializer: @_TFC4main3MD5cfMS0_FT_S0_ [override] // main.MD5.init (main.MD5.Type)() -> main.MD5
#Hash.update: @_TFC4main4Hash6updatefS0_FT_T_ [inherited] // main.Hash.update (main.Hash)() -> ()
#Hash.hash: @_TFC4main4Hash4hashfS0_FT_T_ [inherited] // main.Hash.hash (main.Hash)() -> ()
}