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

59 lines
2.5 KiB
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xllvm -sil-print-types -emit-silgen -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=stub | %FileCheck %s --check-prefixes=CHECK
// REQUIRES: objc_interop
import Foundation
func foo() {}
@available(*, unavailable)
@objc public class C: NSObject {
// C.__allocating_init()
// CHECK-LABEL: sil{{.*}}@$s4Test1CCACycfC
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK: {{%.*}} = function_ref @$s4Test1CCACycfcTD
// CHECK: } // end sil function '$s4Test1CCACycfC'
//
// dynamic C.init()
// CHECK-LABEL: sil{{.*}}@$s4Test1CCACycfcTD
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK: objc_method %0 : $C, #C.init!initializer.foreign
// CHECK: } // end sil function '$s4Test1CCACycfcTD'
//
// C.init()
// CHECK-LABEL: sil{{.*}}@$s4Test1CCACycfc
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK: {{%.*}} = function_ref @$s4Test3fooyyF
// CHECK: } // end sil function '$s4Test1CCACycfc'
//
// @objc C.init()
// CHECK-LABEL: sil{{.*}}@$s4Test1CCACycfcTo
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK: {{%.*}} = function_ref @$s4Test1CCACycfc
// CHECK: } // end sil function '$s4Test1CCACycfcTo'
public override init() {
foo()
}
// C.__deallocating_deinit
// CHECK-LABEL: sil{{.*}}@$s4Test1CCfD
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK: {{%.*}} = function_ref @$s4Test3fooyyF
// CHECK: } // end sil function '$s4Test1CCfD'
//
// @objc C.__deallocating_deinit
// CHECK-LABEL: sil{{.*}}@$s4Test1CCfDTo
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN]] : $@convention(thin) () -> Never
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
// CHECK: {{%.*}} = function_ref @$s4Test1CCfD
// CHECK: } // end sil function '$s4Test1CCfDTo'
deinit {
foo()
}
}