mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Tool selection is primarily done by checking the executable (= symlink) name. But sometimes (e.g. if the tool symlink is not there) it's useful to have an option for selecting the tool. The selection option (e.g. -sil-opt) must be the first argument of swift-frontend.
70 lines
1.9 KiB
Plaintext
70 lines
1.9 KiB
Plaintext
// RUN: %target-sil-nm %s | %FileCheck -check-prefix=SIL-NM -check-prefix=CHECK %s
|
|
// RUN: %target-sil-nm -demangle %s | %FileCheck -check-prefix=DEMANGLE %s
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-sil-opt -module-name main -emit-sib -o %t/out.sib %s
|
|
// RUN: %target-sil-nm -module-name main %t/out.sib | %FileCheck %s
|
|
// RUN: %target-sil-nm -module-name main -demangle %t/out.sib | %FileCheck -check-prefix=DEMANGLE %s
|
|
|
|
// Use this testfile to check if the `swift-frontend -sil-nm` option works.
|
|
// RUN: %swift_frontend_plain -sil-nm %s | %FileCheck -check-prefix=SIL-NM -check-prefix=CHECK %s
|
|
|
|
import Builtin
|
|
|
|
public class C {
|
|
deinit
|
|
init()
|
|
}
|
|
|
|
struct ConformingGenericStruct<T> : ResilientProtocol {
|
|
func defaultA()
|
|
}
|
|
|
|
public protocol ResilientProtocol {
|
|
func defaultA()
|
|
}
|
|
|
|
// CHECK: F c_deinit
|
|
sil [serialized] @c_deinit : $@convention(method) (@owned C) -> () {
|
|
bb0(%0 : $C):
|
|
%1 = tuple()
|
|
return %1 : $()
|
|
}
|
|
|
|
// CHECK: F defaultA
|
|
sil [serialized] @defaultA : $@convention(witness_method: ResilientProtocol) <Self where Self : ResilientProtocol> (@in_guaranteed Self) -> () {
|
|
bb0(%0 : $*Self):
|
|
%result = tuple ()
|
|
return %result : $()
|
|
}
|
|
|
|
// CHECK: F f1
|
|
sil [serialized] @f1 : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK: F globalinit
|
|
sil [serialized] @globalinit : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK: G global_var
|
|
sil_global [serialized] @global_var : $Builtin.Int32
|
|
|
|
// CHECK: W $s4main23ConformingGenericStructVyxGAA17ResilientProtocolAAWP
|
|
// DEMANGLE: W protocol witness table for main.ConformingGenericStruct<A> : main.ResilientProtocol in main
|
|
sil_witness_table [serialized] <T> ConformingGenericStruct<T> : ResilientProtocol module protocol_resilience {
|
|
method #ResilientProtocol.defaultA: @defaultA
|
|
}
|
|
|
|
// vtables cannot be serialized from SIL.
|
|
// SIL-NM: V C
|
|
sil_vtable [serialized] C {
|
|
#C.deinit!deallocator: @c_deinit
|
|
}
|
|
|
|
|