mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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.
31 lines
1.5 KiB
Swift
31 lines
1.5 KiB
Swift
// RUN: %target-swift-frontend -enable-objc-interop -import-objc-header %S/Inputs/throwing-mismarked-nonnullable-error.h %s -Xllvm -sil-print-types -emit-sil | %FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
// Make sure that we do not crash when importing a non-null NSError as
|
|
// throwing. We really just shouldn't expect this at all. I filed: rdar://94656178
|
|
// to track that work.
|
|
|
|
// CHECK-LABEL: sil hidden {{.*}}@$s4main1fyyF : $@convention(thin) () -> () {
|
|
// CHECK: [[STACK:%.*]] = alloc_stack [dynamic_lifetime] $Optional<NSError>
|
|
// CHECK: inject_enum_addr [[STACK]] : $*Optional<NSError>, #Optional.none!enumelt
|
|
// CHECK: [[FN:%.*]] = objc_method {{%[0-9]+}} : $MyClass, #MyClass.submit!foreign : (MyClass) -> () throws -> (), $@convention(objc_method) (Optional<AutoreleasingUnsafeMutablePointer<NSError>>, MyClass) -> ObjCBool
|
|
// CHECK: [[NEXT_STACK:%.*]] = alloc_stack $@sil_unmanaged Optional<NSError>
|
|
// CHECK: [[VAL:%.*]] = load [[STACK]] : $*Optional<NSError>
|
|
// CHECK: [[UNMANAGED:%.*]] = ref_to_unmanaged [[VAL]]
|
|
// CHECK: store [[UNMANAGED]] to [[NEXT_STACK]]
|
|
// CHECK: [[PTR:%.*]] = address_to_pointer [stack_protection] [[NEXT_STACK]]
|
|
// CHECK: [[AUMP:%.*]] = struct $AutoreleasingUnsafeMutablePointer<NSError> ([[PTR]] :
|
|
// CHECK: [[OPT_AUMP:%.*]] = enum $Optional<AutoreleasingUnsafeMutablePointer<NSError>>, #Optional.some!enumelt, [[AUMP]] : $AutoreleasingUnsafeMutablePointer<NSError>
|
|
// CHECK: apply {{%.*}}([[OPT_AUMP]],
|
|
// CHECK: } // end sil function '$s4main1fyyF'
|
|
|
|
func f() {
|
|
let c = MyClass()
|
|
do {
|
|
try c.submit()
|
|
} catch {}
|
|
}
|
|
|
|
f()
|