mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
37 lines
1016 B
Plaintext
37 lines
1016 B
Plaintext
// REQUIRES: objc_interop
|
|
|
|
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -I %S/../Inputs/custom-modules %s -emit-ir | %FileCheck %s
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
import ObjCRuntimeVisible
|
|
|
|
// CHECK: [[CLASS_NAME:@.*]] = private unnamed_addr constant [22 x i8] c"MyRuntimeVisibleClass\00"
|
|
|
|
// CHECK: define swiftcc %objc_class* @getClassA() #0 {
|
|
sil @getClassA : $@convention(thin) () -> @objc_metatype A.Type {
|
|
bb0:
|
|
// CHECK: call %objc_class* @objc_lookUpClass(i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[CLASS_NAME]],
|
|
%0 = metatype $@objc_metatype A.Type
|
|
|
|
// CHECK-NEXT: ret %objc_class*
|
|
return %0 : $@objc_metatype A.Type
|
|
}
|
|
|
|
// CHECK: define swiftcc void @deallocA(%TSo1AC*) #0 {
|
|
sil @deallocA : $@convention(thin) (@owned A) -> () {
|
|
bb0(%0 : $A):
|
|
%1 = metatype $@thick A.Type
|
|
|
|
// CHECK: call %objc_object* @object_dispose
|
|
dealloc_partial_ref %0 : $A, %1 : $@thick A.Type
|
|
|
|
%2 = tuple ()
|
|
|
|
// CHECK-NEXT: ret
|
|
return %2 : $()
|
|
}
|