Files
swift-mirror/test/Interop/Cxx/class/function-call-macosx.swift
Erik Eckstein 7cceaff5f3 SIL: don't print operand types in textual SIL
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.
2024-11-21 18:49:52 +01:00

37 lines
1.7 KiB
Swift

// RUN: %target-swiftxx-frontend -I %S/Inputs -Xllvm -sil-print-types -emit-silgen %s | %FileCheck --dump-input-filter=all %s
// REQUIRES: OS=macosx
import Closure
// CHECK: sil [ossa] @$s4main11testARCWeakyyF : $@convention(thin) () -> () {
// CHECK: %[[V0:.*]] = alloc_stack $ARCWeak
// CHECK: %[[V2:.*]] = function_ref @_ZN7ARCWeakC1Ev : $@convention(c) () -> @out ARCWeak
// CHECK: %[[V3:.*]] = apply %[[V2]](%[[V0]]) : $@convention(c) () -> @out ARCWeak
// CHECK: %[[V4:.*]] = function_ref @_Z12cfuncARCWeak7ARCWeak : $@convention(c) (@in ARCWeak) -> ()
// CHECK: %[[V7:.*]] = apply %[[V4]](%[[V0]]) : $@convention(c) (@in ARCWeak) -> ()
// CHECK-NOT: destroy_addr
// CHECK: dealloc_stack %[[V0]] : $*ARCWeak
public func testARCWeak() {
cfuncARCWeak(ARCWeak());
}
// CHECK: sil [ossa] @$s4main26testARCWeakFunctionPointeryyF : $@convention(thin) () -> () {
// CHECK: %[[V0:.*]] = function_ref @_Z9getFnPtr2v : $@convention(c) () -> @convention(c) (@in ARCWeak) -> ()
// CHECK: %[[V1:.*]] = apply %[[V0]]() : $@convention(c) () -> @convention(c) (@in ARCWeak) -> ()
// CHECK: %[[MV1:.*]] = move_value [var_decl] %[[V1]] : $@convention(c) (@in ARCWeak) -> ()
// CHECK: %[[V3:.*]] = alloc_stack $ARCWeak
// CHECK: %[[V6:.*]] = function_ref @_ZN7ARCWeakC1Ev : $@convention(c) () -> @out ARCWeak
// CHECK: apply %[[V6]](%[[V3]]) : $@convention(c) () -> @out ARCWeak
// CHECK: apply %[[MV1]](%[[V3]]) : $@convention(c) (@in ARCWeak) -> ()
// CHECK-NEXT: dealloc_stack %[[V3]] : $*ARCWeak
// CHECK-NEXT: extend_lifetime %[[MV1]] : $@convention(c) (@in ARCWeak) -> ()
// CHECK-NEXT: %[[V9:.*]] = tuple ()
// CHECK-NEXT: return %[[V9]] : $()
public func testARCWeakFunctionPointer() {
let f = getFnPtr2()
f(ARCWeak())
}