Files
swift-mirror/test/DebugInfo/mandatory-inlining-ownership.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

25 lines
818 B
Swift

// REQUIRES: objc_interop
// RUN: %target-swift-frontend -Xllvm -sil-print-types -emit-sil %s -Onone -Xllvm \
// RUN: -sil-print-after=mandatory-inlining \
// RUN: -Xllvm -sil-print-types -Xllvm -sil-print-debuginfo -o /dev/null 2>&1 | %FileCheck %s
// CHECK: sil_scope [[S0:[0-9]+]] { {{.*}} parent @$s4null3baryyF
// CHECK: sil_scope [[S1:[0-9]+]] { loc "{{.*}}":18:3 parent [[S0]] }
// CHECK: sil_scope [[S2:[0-9]+]] { loc "{{.*}}":18:82 parent [[S1]] }
// CHECK: begin_borrow {{.*}} : $OSLog, loc {{.*}}, scope [[S2]]
// CHECK: tuple (), loc {{.*}}, scope [[S2]]
// CHECK: end_borrow %9 : $OSLog, loc {{.*}}, scope [[S2]]
import os
func bar() {
if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, visionOS 9999, *) {
foo(OSLog.default)
}
}
@_transparent
func foo(_ logObject: OSLog) { }