Files
swift-mirror/test/SILOptimizer/functionsigopts_string_fileprivate.swift
Zak Kent 3b4e94f65b [SILGen] Emit toplevel code through emitFunctionDefinition
Emit SILDeclRefs representing entry points with SourceFile
source correctly.
2023-08-08 11:25:11 -07:00

23 lines
1.1 KiB
Swift

// RUN: %target-swift-frontend -O -emit-sil -primary-file %s | %FileCheck %s
private var _storage: String? = nil
// CHECK-LABEL: sil private [noinline] @$s34functionsigopts_string_fileprivate12setStorageTo33_{{[a-zA-Z0-9]+}} : $@convention(thin) (@guaranteed String) -> () {
// CHECK: bb{{[0-9]+}}([[STRING:%.*]] : $String):
// CHECK: [[FUNCTION:%.*]] = function_ref @$s34functionsigopts_string_fileprivate10setStorage33_{{[a-zA-Z0-9]+}}_tF
// CHECK: apply [[FUNCTION]]([[STRING]])
// CHECK-LABEL: } // end sil function '$s34functionsigopts_string_fileprivate12setStorageTo33_{{[a-zA-Z0-9]+}}'
@inline(never)
fileprivate func setStorageTo(_ newValue: String) {
setStorage(to: newValue)
}
// CHECK-LABEL: sil private [noinline] @$s34functionsigopts_string_fileprivate10setStorage33_{{[a-zA-Z0-9]+}}_tF : $@convention(thin) (@guaranteed String) -> () {
// CHECK-LABEL: } // end sil function '$s34functionsigopts_string_fileprivate10setStorage33_{{[a-zA-Z0-9]+}}_tF'
@inline(never)
fileprivate func setStorage(to newValue: String) {
_storage = newValue
}
setStorageTo("hi")