99@_section ( " __DATA,__mysection " ) public var g3 : Bool = true
1010@_section ( " __DATA,__mysection " ) var g4 : UnsafeMutablePointer < Int > ? = nil
1111@_section ( " __DATA,__mysection " ) var g5 : UnsafeMutablePointer < Int > ? = UnsafeMutablePointer ( bitPattern: 0x42424242 )
12- @_section ( " __TEXT,__mysection " ) func foo( ) { }
12+ @_section ( " __TEXT,__mysection " ) @ _used func foo( ) { }
1313
1414struct MyStruct {
1515 @_section ( " __DATA,__mysection " ) static var static0 : Int = 1
16- @_section ( " __TEXT,__mysection " ) func foo( ) { }
16+ @_section ( " __TEXT,__mysection " ) @ _used func foo( ) { }
1717}
1818
1919// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g0: Int { get set }
@@ -22,10 +22,10 @@ struct MyStruct {
2222// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue public var g3: Bool { get set }
2323// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g4: UnsafeMutablePointer<Int>? { get set }
2424// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g5: UnsafeMutablePointer<Int>? { get set }
25- // SIL: @_section("__TEXT,__mysection") func foo()
25+ // SIL: @_section("__TEXT,__mysection") @_used func foo()
2626// SIL: struct MyStruct {
2727// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue static var static0: Int { get set }
28- // SIL: @_section("__TEXT,__mysection") func foo()
28+ // SIL: @_section("__TEXT,__mysection") @_used func foo()
2929
3030// SIL: sil private [global_init_once_fn] [perf_constraint] @$s7section2g0_WZ : $@convention(c)
3131// SIL: sil hidden [global_init] @$s7section2g0Sivau : $@convention(thin)
@@ -39,10 +39,10 @@ struct MyStruct {
3939// SIL: sil hidden [global_init] @$s7section2g4SpySiGSgvau : $@convention(thin)
4040// SIL: sil private [global_init_once_fn] [perf_constraint] @$s7section2g5_WZ : $@convention(c)
4141// SIL: sil hidden [global_init] @$s7section2g5SpySiGSgvau : $@convention(thin)
42- // SIL: sil hidden [section "__TEXT,__mysection"] @$s7section3fooyyF : $@convention(thin)
42+ // SIL: sil hidden [used] [ section "__TEXT,__mysection"] @$s7section3fooyyF : $@convention(thin)
4343// SIL: sil private [global_init_once_fn] [perf_constraint] @$s7section8MyStructV7static0_WZ : $@convention(c)
4444// SIL: sil hidden [global_init] @$s7section8MyStructV7static0Sivau : $@convention(thin)
45- // SIL: sil hidden [section "__TEXT,__mysection"] @$s7section8MyStructV3fooyyF : $@convention(method)
45+ // SIL: sil hidden [used] [ section "__TEXT,__mysection"] @$s7section8MyStructV3fooyyF : $@convention(method)
4646
4747// IR: @"$s7section2g0Sivp" = hidden global %TSi <{ {{(i64|i32)}} 1 }>, section "__DATA,__mysection"
4848// IR: @"$s7section2g1Si_Sitvp" = hidden global <{ %TSi, %TSi }> <{ %TSi <{ {{(i64|i32)}} 42 }>, %TSi <{ {{(i64|i32)}} 43 }> }>, section "__DATA,__mysection"
0 commit comments