Skip to content

Commit d3bad12

Browse files
authored
Merge pull request #22736 from slavapestov/availability-weak-import-better-test
IRGen: Improve weak_import_availability.swift test
2 parents 9eeabc9 + cfc3725 commit d3bad12

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

test/IRGen/weak_import_availability.swift

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/weak_import_availability_helper.swiftmodule -parse-as-library %S/Inputs/weak_import_availability_helper.swift -enable-resilience
33
//
4-
// RUN: %target-swift-frontend -primary-file %s -I %t -emit-ir | %FileCheck %s
4+
// RUN: %target-swift-frontend -primary-file %s -I %t -emit-ir | %FileCheck %s --check-prefix=CHECK-OLD
5+
// RUN: %target-swift-frontend -primary-file %s -I %t -emit-ir -target x86_64-apple-macosx10.50 | %FileCheck %s --check-prefix=CHECK-NEW
6+
// RUN: %target-swift-frontend -primary-file %s -I %t -emit-ir -target x86_64-apple-macosx10.60 | %FileCheck %s --check-prefix=CHECK-NEW
57

68
// REQUIRES: OS=macosx
9+
// REQUIRES: CPU=x86_64
710

811
import weak_import_availability_helper
912

@@ -14,7 +17,8 @@ public func useConditionallyAvailableCase(e: AlwaysAvailableEnum) {
1417
}
1518
}
1619

17-
// CHECK-LABEL: @"$s31weak_import_availability_helper19AlwaysAvailableEnumO013conditionallyF4CaseyA2CmFWC" = extern_weak constant i32
20+
// CHECK-OLD-LABEL: @"$s31weak_import_availability_helper19AlwaysAvailableEnumO013conditionallyF4CaseyA2CmFWC" = extern_weak constant i32
21+
// CHECK-NEW-LABEL: @"$s31weak_import_availability_helper19AlwaysAvailableEnumO013conditionallyF4CaseyA2CmFWC" = external constant i32
1822

1923
func useConformance<T : AlwaysAvailableProtocol>(_: T.Type) {}
2024

@@ -26,14 +30,16 @@ public func useConditionallyAvailableConformance() {
2630
// FIXME: We reference the witness table directly -- that's a bug since the module is resilient. Should reference the
2731
// conformance descriptor instead.
2832

29-
// CHECK-LABEL: @"$s31weak_import_availability_helper21AlwaysAvailableStructVAA0eF8ProtocolAAWP" = extern_weak global i8*
33+
// CHECK-OLD-LABEL: @"$s31weak_import_availability_helper21AlwaysAvailableStructVAA0eF8ProtocolAAWP" = extern_weak global i8*
34+
// CHECK-NEW-LABEL: @"$s31weak_import_availability_helper21AlwaysAvailableStructVAA0eF8ProtocolAAWP" = external global i8*
3035

3136
@available(macOS 10.50, *)
3237
public func callConditionallyAvailableFunction() {
3338
conditionallyAvailableFunction()
3439
}
3540

36-
// CHECK-LABEL: declare extern_weak swiftcc void @"$s31weak_import_availability_helper30conditionallyAvailableFunctionyyF"()
41+
// CHECK-OLD-LABEL: declare extern_weak swiftcc void @"$s31weak_import_availability_helper30conditionallyAvailableFunctionyyF"()
42+
// CHECK-NEW-LABEL: declare swiftcc void @"$s31weak_import_availability_helper30conditionallyAvailableFunctionyyF"()
3743

3844
@available(macOS 10.50, *)
3945
public func useConditionallyAvailableGlobal() {
@@ -42,9 +48,11 @@ public func useConditionallyAvailableGlobal() {
4248
conditionallyAvailableGlobal += 1
4349
}
4450

45-
// CHECK-LABEL: declare extern_weak swiftcc i64 @"$s31weak_import_availability_helper28conditionallyAvailableGlobalSivg"()
51+
// CHECK-OLD-LABEL: declare extern_weak swiftcc i64 @"$s31weak_import_availability_helper28conditionallyAvailableGlobalSivg"()
52+
// CHECK-NEW-LABEL: declare swiftcc i64 @"$s31weak_import_availability_helper28conditionallyAvailableGlobalSivg"()
4653

47-
// CHECK-LABEL: declare extern_weak swiftcc void @"$s31weak_import_availability_helper28conditionallyAvailableGlobalSivs"(i64)
54+
// CHECK-OLD-LABEL: declare extern_weak swiftcc void @"$s31weak_import_availability_helper28conditionallyAvailableGlobalSivs"(i64)
55+
// CHECK-NEW-LABEL: declare swiftcc void @"$s31weak_import_availability_helper28conditionallyAvailableGlobalSivs"(i64)
4856

4957
func blackHole<T>(_: T) {}
5058

@@ -53,11 +61,13 @@ public func useConditionallyAvailableStruct() {
5361
blackHole(ConditionallyAvailableStruct.self)
5462
}
5563

56-
// CHECK-LABEL: declare extern_weak swiftcc %swift.metadata_response @"$s31weak_import_availability_helper28ConditionallyAvailableStructVMa"(i64)
64+
// CHECK-OLD-LABEL: declare extern_weak swiftcc %swift.metadata_response @"$s31weak_import_availability_helper28ConditionallyAvailableStructVMa"(i64)
65+
// CHECK-NEW-LABEL: declare swiftcc %swift.metadata_response @"$s31weak_import_availability_helper28ConditionallyAvailableStructVMa"(i64)
5766

5867
@available(macOS 10.50, *)
5968
public func useConditionallyAvailableMethod(s: ConditionallyAvailableStruct) {
6069
s.conditionallyAvailableMethod()
6170
}
6271

63-
// CHECK-LABEL: declare extern_weak swiftcc void @"$s31weak_import_availability_helper28ConditionallyAvailableStructV013conditionallyF6MethodyyF"(%swift.opaque* noalias nocapture swiftself)
72+
// CHECK-OLD-LABEL: declare extern_weak swiftcc void @"$s31weak_import_availability_helper28ConditionallyAvailableStructV013conditionallyF6MethodyyF"(%swift.opaque* noalias nocapture swiftself)
73+
// CHECK-NEW-LABEL: declare swiftcc void @"$s31weak_import_availability_helper28ConditionallyAvailableStructV013conditionallyF6MethodyyF"(%swift.opaque* noalias nocapture swiftself)

0 commit comments

Comments
 (0)