Files
swift-mirror/test/SILGen/dynamic_lookup_throws.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

31 lines
1.3 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %build-clang-importer-objc-overlays
// RUN: %target-swift-emit-silgen(mock-sdk: %clang-importer-sdk-nosource -I %t) -Xllvm -sil-print-types -module-name dynamic_lookup_throws -parse-as-library %s | %FileCheck %s
// REQUIRES: objc_interop
import Foundation
class Blub : NSObject {
@objc func blub() throws {}
}
// CHECK-LABEL: sil hidden [ossa] @$s21dynamic_lookup_throws8testBlub1ayyXl_tKF : $@convention(thin) (@guaranteed AnyObject) -> @error any Error
// CHECK: bb0([[ARG:%.*]] : @guaranteed $AnyObject):
func testBlub(a: AnyObject) throws {
// CHECK: [[ANYOBJECT_REF:%.*]] = open_existential_ref [[ARG]] : $AnyObject to $@opened("[[OPENED:.*]]", AnyObject) Self
// CHECK: [[ANYOBJECT_REF_COPY:%.*]] = copy_value [[ANYOBJECT_REF]]
// CHECK: objc_method [[ANYOBJECT_REF_COPY]] : $@opened("[[OPENED]]", AnyObject) Self, #Blub.blub!foreign : (Blub) -> () throws -> (), $@convention(objc_method) (Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @opened("[[OPENED]]", AnyObject) Self) -> ObjCBool
// CHECK: cond_br {{%.*}}, bb1, bb2
// CHECK: bb1
// CHECK: return
// CHECK: bb2
// CHECK: function_ref @$s10Foundation22_convertNSErrorToErrorys0E0_pSo0C0CSgF
// CHECK: throw {{%.*}} : $any Error
try a.blub()
}