Skip to content

test: improve SILGen coverage on Windows #21371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions test/SILGen/collection_upcast.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

// RUN: %target-swift-emit-silgen -module-name collection_upcast -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -module-name collection_upcast -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -enable-objc-interop -disable-objc-attr-requires-foundation-module | %FileCheck %s

// FIXME: rdar://problem/19648117 Needs splitting objc parts out
// XFAIL: linux

import Foundation

Expand Down
20 changes: 13 additions & 7 deletions test/SILGen/enum_raw_representable_objc.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
// RUN: %target-swift-emit-silgen -emit-sorted-sil -enable-objc-interop -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -emit-sorted-sil -enable-objc-interop -disable-objc-attr-requires-foundation-module -enable-resilience %s | %FileCheck -check-prefix=CHECK-RESILIENT %s

#if os(Windows) && arch(x86_64)
@objc public enum CLike: Int32 {
case a, b, c
}
#else
@objc public enum CLike: Int {
case a, b, c
}
#endif

// CHECK-LABEL: sil [serialized] @$s27enum_raw_representable_objc5CLikeO0B5ValueACSgSi_tcfC
// CHECK-LABEL: sil [serialized] @$s27enum_raw_representable_objc5CLikeO0B5ValueACSg{{Si|s5Int32V}}_tcfC

// CHECK-LABEL: sil [serialized] @$s27enum_raw_representable_objc5CLikeO0B5ValueSivg
// CHECK-LABEL: sil [serialized] @$s27enum_raw_representable_objc5CLikeO0B5Value{{Si|s5Int32V}}vg
// CHECK-DAG: [[RESULT_BOX:%.+]] = alloc_stack $Int
// CHECK-DAG: [[INPUT_BOX:%.+]] = alloc_stack $CLike
// CHECK: [[RAW_TYPE:%.+]] = metatype $@thick Int.Type
// CHECK: [[RAW_TYPE:%.+]] = metatype $@thick Int{{(32)?}}.Type
// CHECK: [[CAST_FUNC:%.+]] = function_ref @$ss13unsafeBitCast_2toq_x_q_mtr0_lF
// CHECK: = apply [[CAST_FUNC]]<CLike, Int>([[RESULT_BOX]], [[INPUT_BOX]], [[RAW_TYPE]])
// CHECK: = apply [[CAST_FUNC]]<CLike, Int{{(32)?}}>([[RESULT_BOX]], [[INPUT_BOX]], [[RAW_TYPE]])
// CHECK: [[RESULT:%.+]] = load [trivial] [[RESULT_BOX]]
// CHECK: return [[RESULT]]
// CHECK: end sil function '$s27enum_raw_representable_objc5CLikeO0B5ValueSivg'
// CHECK: end sil function '$s27enum_raw_representable_objc5CLikeO0B5Value{{Si|s5Int32V}}vg'

// CHECK-RESILIENT-DAG: sil @$s27enum_raw_representable_objc5CLikeO0B5ValueSivg
// CHECK-RESILIENT-DAG: sil @$s27enum_raw_representable_objc5CLikeO0B5ValueACSgSi_tcfC
// CHECK-RESILIENT-DAG: sil @$s27enum_raw_representable_objc5CLikeO0B5Value{{Si|s5Int32V}}vg
// CHECK-RESILIENT-DAG: sil @$s27enum_raw_representable_objc5CLikeO0B5ValueACSg{{Si|s5Int32V}}_tcfC
2 changes: 1 addition & 1 deletion test/SILGen/imported_struct_array_field.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-silgen -import-objc-header %S/Inputs/array_typedef.h %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/array_typedef.h %s | %FileCheck %s

// CHECK-LABEL: sil shared [transparent] [serializable] @$sSo4NameV{{[_0-9a-zA-Z]*}}fC : $@convention(method) (UInt8, UInt8, UInt8, UInt8, @thin Name.Type) -> Name
func useImportedArrayTypedefInit() -> Name {
Expand Down
2 changes: 1 addition & 1 deletion test/SILGen/lying_about_optional_return.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-silgen -import-objc-header %S/Inputs/c_function_pointer_in_c_struct.h %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %S/Inputs/c_function_pointer_in_c_struct.h %s | %FileCheck %s

// CHECK-LABEL: sil hidden @$s27lying_about_optional_return0C37ChainingForeignFunctionTypeProperties{{[_0-9a-zA-Z]*}}F
func optionalChainingForeignFunctionTypeProperties(a: SomeCallbacks?) {
Expand Down
4 changes: 2 additions & 2 deletions test/SILGen/pointer_conversion.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

// RUN: %target-swift-emit-silgen -module-name pointer_conversion -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -module-name pointer_conversion -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -enable-objc-interop | %FileCheck %s

// FIXME: rdar://problem/19648117 Needs splitting objc parts out
// XFAIL: linux
// REQUIRES: objc_interop

import Foundation

Expand Down
503 changes: 272 additions & 231 deletions test/SILGen/witness_tables.swift

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions test/SILGen/witness_tables_serialized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ public struct PublicResilientStruct : PublicProtocol, InternalProtocol {}
@usableFromInline
internal struct InternalStruct : PublicProtocol, InternalProtocol {}

// CHECK: sil_witness_table [serialized] PublicStruct: PublicProtocol
// CHECK: sil_witness_table [serialized] PublicStruct: InternalProtocol

// CHECK-NONRESILIENT: sil_witness_table [serialized] PublicResilientStruct: PublicProtocol
// CHECK-NONRESILIENT: sil_witness_table [serialized] PublicResilientStruct: InternalProtocol
// CHECK-RESILIENT: sil_witness_table PublicResilientStruct: PublicProtocol
// CHECK-RESILIENT: sil_witness_table PublicResilientStruct: InternalProtocol

// CHECK-NONRESILIENT: sil_witness_table [serialized] InternalStruct: PublicProtocol
// CHECK-NONRESILIENT: sil_witness_table [serialized] InternalStruct: InternalProtocol
// CHECK-RESILIENT: sil_witness_table InternalStruct: PublicProtocol
// CHECK-RESILIENT: sil_witness_table InternalStruct: InternalProtocol
// CHECK-DAG: sil_witness_table [serialized] PublicStruct: PublicProtocol
// CHECK-DAG: sil_witness_table [serialized] PublicStruct: InternalProtocol

// CHECK-RESILIENT-DAG: sil_witness_table InternalStruct: InternalProtocol
// CHECK-RESILIENT-DAG: sil_witness_table InternalStruct: PublicProtocol

// CHECK-RESILIENT-DAG: sil_witness_table PublicResilientStruct: PublicProtocol
// CHECK-RESILIENT-DAG: sil_witness_table PublicResilientStruct: InternalProtocol

// CHECK-NONRESILIENT-DAG: sil_witness_table [serialized] InternalStruct: InternalProtocol
// CHECK-NONRESILIENT-DAG: sil_witness_table [serialized] InternalStruct: PublicProtocol

// CHECK-NONRESILIENT-DAG: sil_witness_table [serialized] PublicResilientStruct: PublicProtocol
// CHECK-NONRESILIENT-DAG: sil_witness_table [serialized] PublicResilientStruct: InternalProtocol
2 changes: 1 addition & 1 deletion test/SILGen/witness_tables_serialized_import.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -enable-sil-ownership -emit-module %S/witness_tables_serialized.swift -o %t -enable-resilience
// RUN: %target-swift-emit-silgen -enable-sil-ownership -I %t %s | %FileCheck %s
// RUN: %target-swift-emit-silgen -emit-sorted-sil -enable-sil-ownership -I %t %s | %FileCheck %s

import witness_tables_serialized

Expand Down