File: skip_non_exportable_decls.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (197 lines) | stat: -rw-r--r-- 11,271 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-silgen %s -parse-as-library -enable-library-evolution -module-name Test | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-SKIP
// RUN: %target-swift-frontend -emit-silgen %s -parse-as-library -enable-library-evolution -module-name Test -experimental-skip-non-exportable-decls | %FileCheck %s --check-prefixes=CHECK,CHECK-SKIP

import Swift

#warning("!")

// CHECK-NO-SKIP: sil_global private @$s4Test17internalGlobalVar_Wz : $Builtin.Word
// CHECK-SKIP-NOT: s4Test17internalGlobalVar_Wz

// CHECK-NO-SKIP: sil_global hidden @$s4Test17internalGlobalVarSivp : $Int
// CHECK-SKIP-NOT: s4Test17internalGlobalVarSivp

// CHECK-NO-SKIP: sil_global private @$s4Test15publicGlobalVar_Wz : $Builtin.Word
// CHECK-SKIP-NOT: s4Test15publicGlobalVar_Wz

// CHECK: sil_global private @$s4Test15publicGlobalVarSivp : $Int

// CHECK-NO-SKIP: sil private{{.*}} @$s4Test11privateFunc33_CFB3F9DC47F5EF9E1D08B58758351A08LLyyF : $@convention(thin) () -> () {
// CHECK-SKIP-NOT: s4Test11privateFunc33_CFB3F9DC47F5EF9E1D08B58758351A08LLyyF
private func privateFunc() {}

// CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test12internalFuncyyF : $@convention(thin) () -> () {
// CHECK-SKIP-NOT: s4Test12internalFuncyyF
internal func internalFunc() {}

// CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test022internalFuncWithNestedC0yyF : $@convention(thin) () -> () {
// CHECK-SKIP-NOT: s4Test022internalFuncWithNestedC0yyF
internal func internalFuncWithNestedFunc() {
  defer { internalFunc() }
  func nested() {}
  nested()
  let _: () -> () = {
    defer { internalFunc() }
    internalFunc()
  }()
}
// CHECK-NO-SKIP: sil private{{.*}} @$s4Test022internalFuncWithNestedC0yyF6$deferL_yyF : $@convention(thin) () -> () {
// CHECK-SKIP-NOT: s4Test022internalFuncWithNestedC0yyF6$deferL_yyF

// CHECK-NO-SKIP: sil private{{.*}} @$s4Test022internalFuncWithNestedC0yyF6nestedL_yyF : $@convention(thin) () -> () {
// CHECK-SKIP-NOT: s4Test022internalFuncWithNestedC0yyF6nestedL_yyF

// CHECK-NO-SKIP: sil private{{.*}} @$s4Test022internalFuncWithNestedC0yyFyycyXEfU_ : $@convention(thin) () -> @owned @callee_guaranteed () -> () {
// CHECK-SKIP-NOT: s4Test022internalFuncWithNestedC0yyFyycyXEfU_

// CHECK-NO-SKIP: sil private{{.*}} @$s4Test022internalFuncWithNestedC0yyFyycyXEfU_6$deferL_yyF : $@convention(thin) () -> () {
// CHECK-SKIP-NOT: sil{{.*}} @$s4Test022internalFuncWithNestedC0yyFyycyXEfU_6$deferL_yyF

// CHECK: sil{{.*}} @$s4Test10publicFuncyyF : $@convention(thin) () -> () {
public func publicFunc() {}

// CHECK: sil{{.*}} @$s4Test25publicFuncWithNestedFuncsyyF : $@convention(thin) () -> () {
public func publicFuncWithNestedFuncs() {
  defer { publicFunc() }
  func nested() {}
  nested()
}
// CHECK: sil private{{.*}} @$s4Test25publicFuncWithNestedFuncsyyF6$deferL_yyF : $@convention(thin) () -> () {
// CHECK: sil private{{.*}} @$s4Test25publicFuncWithNestedFuncsyyF6nestedL_yyF : $@convention(thin) () -> () {

// CHECK: sil [serialized]{{.*}} @$s4Test13inlinableFuncyyF : $@convention(thin) () -> () {
@inlinable internal func inlinableFunc() {}

// CHECK-NO-SKIP: sil private [global_init_once_fn]{{.*}} @$s4Test17internalGlobalVar_WZ : $@convention(c) (Builtin.RawPointer) -> () {
// CHECK-SKIP-NOT: s4Test17internalGlobalVar_WZ

// CHECK-NO-SKIP: sil hidden [global_init]{{.*}} @$s4Test17internalGlobalVarSivau : $@convention(thin) () -> Builtin.RawPointer {
// CHECK-SKIP-NOT: s4Test17internalGlobalVarSivau
internal var internalGlobalVar = 1

// CHECK-NO-SKIP: sil private [global_init_once_fn]{{.*}} @$s4Test15publicGlobalVar_WZ : $@convention(c) (Builtin.RawPointer) -> () {
// CHECK-SKIP-NOT: s4Test15publicGlobalVar_WZ

// CHECK-NO-SKIP: sil hidden [global_init]{{.*}} @$s4Test15publicGlobalVarSivau : $@convention(thin) () -> Builtin.RawPointer {
// CHECK-SKIP-NOT: sil{{.*}} s4Test15publicGlobalVarSivau
public var publicGlobalVar = 1

// CHECK: sil [serialized]{{.*}} @$s4Test023inlinableFuncWithNestedC0yyF : $@convention(thin) () -> () {
@inlinable internal func inlinableFuncWithNestedFunc() {
  defer { publicFunc() }
  func nested() {}
  nested()
  let _: () -> () = {
    defer { publicFunc() }
    publicFunc()
  }()
}
// CHECK: sil shared [serialized]{{.*}} @$s4Test023inlinableFuncWithNestedC0yyF6$deferL_yyF : $@convention(thin) () -> () {
// CHECK: sil shared [serialized]{{.*}} @$s4Test023inlinableFuncWithNestedC0yyF6nestedL_yyF : $@convention(thin) () -> () {
// CHECK: sil shared [serialized]{{.*}} @$s4Test023inlinableFuncWithNestedC0yyFyycyXEfU_ : $@convention(thin) () -> @owned @callee_guaranteed () -> () {
// CHECK: sil shared [serialized]{{.*}} @$s4Test023inlinableFuncWithNestedC0yyFyycyXEfU_6$deferL_yyF : $@convention(thin) () -> () {

@propertyWrapper
public struct PublicWrapper<T> {
  // CHECK: sil{{.*}} @$s4Test13PublicWrapperV12wrappedValuexvg : $@convention(method) <T> (@in_guaranteed PublicWrapper<T>) -> @out T {
  // CHECK: sil{{.*}} @$s4Test13PublicWrapperV12wrappedValuexvs : $@convention(method) <T> (@in T, @inout PublicWrapper<T>) -> () {
  // CHECK: sil{{.*}} @$s4Test13PublicWrapperV12wrappedValuexvM : $@yield_once @convention(method) <T> (@inout PublicWrapper<T>) -> @yields @inout T {
  public var wrappedValue: T

  // CHECK: sil{{.*}} @$s4Test13PublicWrapperV12wrappedValueACyxGx_tcfC : $@convention(method) <T> (@in T, @thin PublicWrapper<T>.Type) -> @out PublicWrapper<T> {
  public init(wrappedValue: T) { self.wrappedValue = wrappedValue }
}

private class PrivateClass {
  // CHECK-NO-SKIP: sil private{{.*}} @$s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCfd : $@convention(method) (@guaranteed PrivateClass) -> @owned Builtin.NativeObject {
  // CHECK-SKIP-NOT: s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCfd

  // CHECK-NO-SKIP: sil private{{.*}} @$s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCfD : $@convention(method) (@owned PrivateClass) -> () {
  // CHECK-SKIP-NOT: s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCfD

  // CHECK-NO-SKIP: sil private{{.*}} @$s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCADycfC : $@convention(method) (@thick PrivateClass.Type) -> @owned PrivateClass {
  // CHECK-SKIP-NOT: s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCADycfC

  // CHECK-NO-SKIP: sil private{{.*}} @$s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCADycfc : $@convention(method) (@owned PrivateClass) -> @owned PrivateClass {
  // CHECK-SKIP-NOT: s4Test12PrivateClass33_CFB3F9DC47F5EF9E1D08B58758351A08LLCADycfc
}

public class PublicClass {
  // CHECK-NO-SKIP: sil{{.*}} @$s4Test11PublicClassC11internalVarSivpfi : $@convention(thin) () -> Int {
  // CHECK-SKIP-NOT: s4Test11PublicClassC11internalVarSivpfi
  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassC11internalVarSivg : $@convention(method) (@guaranteed PublicClass) -> Int {
  // CHECK-SKIP-NOT: s4Test11PublicClassC11internalVarSivg
  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassC11internalVarSivs : $@convention(method) (Int, @guaranteed PublicClass) -> () {
  // CHECK-SKIP-NOT: s4Test11PublicClassC11internalVarSivs
  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassC11internalVarSivM : $@yield_once @convention(method) (@guaranteed PublicClass) -> @yields @inout Int {
  // CHECK-SKIP-NOT: s4Test11PublicClassC11internalVarSivM
  var internalVar = 1

  // CHECK-NO-SKIP: sil{{.*}} @$s4Test11PublicClassC9publicVarSivpfi : $@convention(thin) () -> Int {
  // CHECK-SKIP-NOT: s4Test11PublicClassC9publicVarSivpfi
  // CHECK: sil{{.*}} @$s4Test11PublicClassC9publicVarSivg : $@convention(method) (@guaranteed PublicClass) -> Int {
  // CHECK: sil{{.*}} @$s4Test11PublicClassC9publicVarSivs : $@convention(method) (Int, @guaranteed PublicClass) -> () {
  // CHECK: sil{{.*}} @$s4Test11PublicClassC9publicVarSivM : $@yield_once @convention(method) (@guaranteed PublicClass) -> @yields @inout Int {
  public var publicVar = 1

  // CHECK-NO-SKIP: sil{{.*}} @$s4Test11PublicClassC16publicWrappedVarSivpfP : $@convention(thin) (Int) -> @out PublicWrapper<Int> {
  // CHECK-SKIP-NOT: s4Test11PublicClassC16publicWrappedVarSivpfP
  // CHECK: sil{{.*}} @$s4Test11PublicClassC16publicWrappedVarSivg : $@convention(method) (@guaranteed PublicClass) -> Int {
  // CHECK: sil{{.*}} @$s4Test11PublicClassC16publicWrappedVarSivs : $@convention(method) (Int, @guaranteed PublicClass) -> () {
  // CHECK: sil{{.*}} @$s4Test11PublicClassC16publicWrappedVarSivM : $@yield_once @convention(method) (@guaranteed PublicClass) -> @yields @inout Int {
  @PublicWrapper public var publicWrappedVar = publicGlobalVar

  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassC14internalMethodyyF : $@convention(method) (@guaranteed PublicClass) -> () {
  // CHECK-SKIP-NOT: s4Test11PublicClassC14internalMethodyyF
  internal func internalMethod() {}

  // CHECK: sil{{.*}} @$s4Test11PublicClassCfd : $@convention(method) (@guaranteed PublicClass) -> @owned Builtin.NativeObject {

  // CHECK: sil{{.*}} @$s4Test11PublicClassCfD : $@convention(method) (@owned PublicClass) -> () {

  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassCACycfC : $@convention(method) (@thick PublicClass.Type) -> @owned PublicClass {
  // CHECK-SKIP-NOT: s4Test11PublicClassCACycfC

  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassCACycfc : $@convention(method) (@owned PublicClass) -> @owned PublicClass {
  // CHECK-SKIP-NOT: s4Test11PublicClassCACycfc
}

extension PublicClass {
  // CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test11PublicClassC25internalMethodInExtensionyyF : $@convention(method) (@guaranteed PublicClass) -> () {
  // CHECK-SKIP-NOT: s4Test11PublicClassC25internalMethodInExtensionyyF
  internal func internalMethodInExtension() {}
}

@frozen public struct FrozenPublicStruct {
  // CHECK: sil non_abi [transparent] [serialized]{{.*}} @$s4Test18FrozenPublicStructV11internalVarSivpfi : $@convention(thin) () -> Int {
  var internalVar = 1
}

// CHECK-NO-SKIP-LABEL: sil_vtable PrivateClass {
// CHECK-NO-SKIP-NEXT:    #PrivateClass.init!allocator
// CHECK-NO-SKIP-NEXT:    #PrivateClass.deinit!deallocator
// CHECK-NO-SKIP-NEXT:  }
// CHECK-SKIP-NOT:      sil_vtable PrivateClass

// CHECK-LABEL:         sil_vtable PublicClass {
// CHECK-NO-SKIP-NEXT:    #PublicClass.internalVar!getter
// CHECK-SKIP-NOT:        #PublicClass.internalVar!getter
// CHECK-NO-SKIP-NEXT:    #PublicClass.internalVar!setter
// CHECK-SKIP-NOT:        #PublicClass.internalVar!setter
// CHECK-NO-SKIP-NEXT:    #PublicClass.internalVar!modify
// CHECK-SKIP-NOT:        #PublicClass.internalVar!modify
// CHECK-NEXT:            #PublicClass.publicVar!getter
// CHECK-NEXT:            #PublicClass.publicVar!setter
// CHECK-NEXT:            #PublicClass.publicVar!modify
// CHECK-NEXT:            #PublicClass.publicWrappedVar!getter
// CHECK-NEXT:            #PublicClass.publicWrappedVar!setter
// CHECK-NEXT:            #PublicClass.publicWrappedVar!modify
// CHECK-NO-SKIP-NEXT:    #PublicClass.internalMethod
// CHECK-SKIP-NOT:        #PublicClass.internalMethod
// CHECK-NO-SKIP-NEXT:    #PublicClass.init!allocator
// CHECK-SKIP-NOT:        #PublicClass.init!allocator
// CHECK-NEXT:            #PublicClass.deinit!deallocator
// CHECK-NEXT:          }

// CHECK:               sil_property #PublicClass.publicVar