Skip to content

Commit 5f037ef

Browse files
committed
Update tests and test expectations on IRGen/section.swift + IRGen/section_asm.swift
1 parent 25cad6f commit 5f037ef

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

test/IRGen/section.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33

44
// REQUIRES: swift_in_compiler
55

6-
@_section("__TEXT,__mysection") var g0: Int = 1
7-
@_section("__TEXT,__mysection") var g1: (Int, Int) = (42, 43)
8-
@_section("__TEXT,__mysection") var g2: Bool = true
9-
@_section("__TEXT,__mysection") public var g3: Bool = true
10-
@_section("__TEXT,__mysection") var g4: UnsafeMutablePointer<Int>? = nil
11-
@_section("__TEXT,__mysection") var g5: UnsafeMutablePointer<Int>? = UnsafeMutablePointer(bitPattern: 0x42424242)
6+
@_section("__DATA,__mysection") var g0: Int = 1
7+
@_section("__DATA,__mysection") var g1: (Int, Int) = (42, 43)
8+
@_section("__DATA,__mysection") var g2: Bool = true
9+
@_section("__DATA,__mysection") public var g3: Bool = true
10+
@_section("__DATA,__mysection") var g4: UnsafeMutablePointer<Int>? = nil
11+
@_section("__DATA,__mysection") var g5: UnsafeMutablePointer<Int>? = UnsafeMutablePointer(bitPattern: 0x42424242)
1212
@_section("__TEXT,__mysection") func foo() {}
1313

1414
struct MyStruct {
15-
@_section("__TEXT,__mysection") static var static0: Int = 1
15+
@_section("__DATA,__mysection") static var static0: Int = 1
1616
@_section("__TEXT,__mysection") func foo() {}
1717
}
1818

19-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue var g0: Int { get set }
20-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue var g1: (Int, Int) { get set }
21-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue var g2: Bool { get set }
22-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue public var g3: Bool { get set }
23-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue var g4: UnsafeMutablePointer<Int>? { get set }
24-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue var g5: UnsafeMutablePointer<Int>? { get set }
19+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g0: Int { get set }
20+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g1: (Int, Int) { get set }
21+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g2: Bool { get set }
22+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue public var g3: Bool { get set }
23+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g4: UnsafeMutablePointer<Int>? { get set }
24+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue var g5: UnsafeMutablePointer<Int>? { get set }
2525
// SIL: @_section("__TEXT,__mysection") func foo()
2626
// SIL: struct MyStruct {
27-
// SIL: @_section("__TEXT,__mysection") @_hasStorage @_hasInitialValue static var static0: Int { get set }
27+
// SIL: @_section("__DATA,__mysection") @_hasStorage @_hasInitialValue static var static0: Int { get set }
2828
// SIL: @_section("__TEXT,__mysection") func foo()
2929

3030
// SIL: sil private [global_init_once_fn] @$s7section2g0_WZ : $@convention(c)
@@ -44,12 +44,12 @@ struct MyStruct {
4444
// SIL: sil hidden [global_init] @$s7section8MyStructV7static0Sivau : $@convention(thin)
4545
// SIL: sil hidden [section "__TEXT,__mysection"] @$s7section8MyStructV3fooyyF : $@convention(method)
4646

47-
// IR: @"$s7section2g0Sivp" = hidden global %TSi <{ {{(i64|i32)}} 1 }>, section "__TEXT,__mysection"
48-
// IR: @"$s7section2g1Si_Sitvp" = hidden global <{ %TSi, %TSi }> <{ %TSi <{ {{(i64|i32)}} 42 }>, %TSi <{ {{(i64|i32)}} 43 }> }>, section "__TEXT,__mysection"
49-
// IR: @"$s7section2g2Sbvp" = hidden global %TSb <{ i1 true }>, section "__TEXT,__mysection"
50-
// IR: @"$s7section2g3Sbvp" = {{.*}}global %TSb <{ i1 true }>, section "__TEXT,__mysection"
51-
// IR: @"$s7section2g4SpySiGSgvp" = hidden global {{i64|i32}} 0, section "__TEXT,__mysection"
52-
// IR: @"$s7section2g5SpySiGSgvp" = hidden global {{i64|i32}} 1111638594, section "__TEXT,__mysection"
53-
// IR: @"$s7section8MyStructV7static0SivpZ" = hidden global %TSi <{ {{(i64|i32)}} 1 }>, section "__TEXT,__mysection"
47+
// IR: @"$s7section2g0Sivp" = hidden global %TSi <{ {{(i64|i32)}} 1 }>, section "__DATA,__mysection"
48+
// IR: @"$s7section2g1Si_Sitvp" = hidden global <{ %TSi, %TSi }> <{ %TSi <{ {{(i64|i32)}} 42 }>, %TSi <{ {{(i64|i32)}} 43 }> }>, section "__DATA,__mysection"
49+
// IR: @"$s7section2g2Sbvp" = hidden global %TSb <{ i1 true }>, section "__DATA,__mysection"
50+
// IR: @"$s7section2g3Sbvp" = {{.*}}global %TSb <{ i1 true }>, section "__DATA,__mysection"
51+
// IR: @"$s7section2g4SpySiGSgvp" = hidden global {{i64|i32}} 0, section "__DATA,__mysection"
52+
// IR: @"$s7section2g5SpySiGSgvp" = hidden global {{i64|i32}} 1111638594, section "__DATA,__mysection"
53+
// IR: @"$s7section8MyStructV7static0SivpZ" = hidden global %TSi <{ {{(i64|i32)}} 1 }>, section "__DATA,__mysection"
5454
// IR: define {{.*}}@"$s7section3fooyyF"(){{.*}} section "__TEXT,__mysection"
5555
// IR: define {{.*}}@"$s7section8MyStructV3fooyyF"() #0 section "__TEXT,__mysection"

test/IRGen/section_asm.swift

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %S/section.swift -S -parse-as-library | %FileCheck %s --check-prefix=ASM --check-prefix ASM-%target-os
1+
// RUN: %target-swift-frontend -enable-experimental-feature SymbolLinkageMarkers -primary-file %S/section.swift -S -parse-as-library | %FileCheck %s
22
// REQUIRES: swift_in_compiler
33
// UNSUPPORTED: CPU=wasm32
44

5-
// ASM: .section{{.*}}__TEXT,__mysection
6-
// ASM-NOT: .section
7-
// ASM: $s7section3fooyyF:
8-
// ASM-linux-gnu: .section{{.*}}__TEXT,__mysection
9-
// ASM-linux-android: .section{{.*}}__TEXT,__mysection
10-
// ASM-linux-androideabi: .section{{.*}}__TEXT,__mysection
11-
// ASM-NOT: .section
12-
// ASM: $s7section2g0Sivp:
13-
// ASM-NOT: .section
14-
// ASM: $s7section2g1Si_Sitvp:
15-
// ASM-NOT: .section
16-
// ASM: $s7section2g2Sbvp:
17-
// ASM-NOT: .section
18-
// ASM: $s7section2g3Sbvp:
19-
// ASM-NOT: .section
20-
// ASM: $s7section2g4SpySiGSgvp:
21-
// ASM-NOT: .section
22-
// ASM: $s7section2g5SpySiGSgvp:
5+
// CHECK: .section{{.*}}__TEXT,__mysection
6+
// CHECK-NOT: .section
7+
// CHECK: $s7section3fooyyF:
8+
9+
// CHECK: .section{{.*}}__TEXT,__mysection
10+
// CHECK-NOT: .section
11+
// CHECK: $s7section8MyStructV3fooyyF:
12+
13+
// CHECK: .section{{.*}}__DATA,__mysection
14+
// CHECK-NOT: .section
15+
// CHECK: $s7section2g0Sivp:
16+
// CHECK-NOT: .section
17+
// CHECK: $s7section2g1Si_Sitvp:
18+
// CHECK-NOT: .section
19+
// CHECK: $s7section2g2Sbvp:
20+
// CHECK-NOT: .section
21+
// CHECK: $s7section2g3Sbvp:
22+
// CHECK-NOT: .section
23+
// CHECK: $s7section2g4SpySiGSgvp:
24+
// CHECK-NOT: .section
25+
// CHECK: $s7section2g5SpySiGSgvp:
26+
// CHECK-NOT: .section
27+
// CHECK: $s7section8MyStructV7static0SivpZ:

0 commit comments

Comments
 (0)