mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
|
|
// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types -module-name extensions_objc -sdk %S/Inputs %s -I %S/Inputs -enable-source-import | %FileCheck %s
|
|
//
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
class Foo {}
|
|
|
|
extension Foo {
|
|
@objc dynamic func kay() {}
|
|
@objc dynamic var cox: Int { return 0 }
|
|
}
|
|
|
|
// CHECK-LABEL: sil hidden [ossa] @$s15extensions_objc19extensionReferencesyyAA3FooCF
|
|
// CHECK: bb0([[ARG:%.*]] : @guaranteed $Foo):
|
|
func extensionReferences(_ x: Foo) {
|
|
// dynamic extension methods are still dynamically dispatched.
|
|
// CHECK: objc_method [[ARG]] : $Foo, #Foo.kay!foreign
|
|
x.kay()
|
|
|
|
// CHECK: objc_method [[ARG]] : $Foo, #Foo.cox!getter.foreign
|
|
_ = x.cox
|
|
|
|
}
|
|
|
|
func extensionMethodCurrying(_ x: Foo) {
|
|
_ = x.kay
|
|
}
|
|
|
|
// CHECK-LABEL: sil private [ossa] @$s15extensions_objc23extensionMethodCurryingyyAA3FooCFyycADcfu_ : $@convention(thin) (@guaranteed Foo) -> @owned @callee_guaranteed () -> () {
|
|
// CHECK: function_ref @$s15extensions_objc23extensionMethodCurryingyyAA3FooCFyycADcfu_yycfu0_ : $@convention(thin) (@guaranteed Foo) -> ()
|
|
|
|
// CHECK-LABEL: sil private [ossa] @$s15extensions_objc23extensionMethodCurryingyyAA3FooCFyycADcfu_yycfu0_ : $@convention(thin) (@guaranteed Foo) -> () {
|
|
// CHECK: objc_method %0 : $Foo, #Foo.kay!foreign : (Foo) -> () -> (), $@convention(objc_method) (Foo) -> ()
|
|
|