Skip to content

Commit 6a6a2b6

Browse files
committed
SILGen: Split Objective-C specific bits out of test/SILGen/vtables.swift
1 parent 00e34e4 commit 6a6a2b6

File tree

2 files changed

+63
-66
lines changed

2 files changed

+63
-66
lines changed

test/SILGen/vtables.swift

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
// RUN: %target-swift-frontend -sdk %S/Inputs -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
2-
3-
// FIXME: rdar://problem/19648117 Needs splitting objc parts out
4-
// XFAIL: linux
5-
6-
import gizmo
7-
8-
// TODO: Generic base classes
1+
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
92

103
// Test for compilation order independence
114
class C : B {
@@ -73,64 +66,6 @@ class B : A {
7366
// CHECK: #B.zang!1: {{.*}} : _T07vtables1BC4zang{{[_0-9a-zA-Z]*}}F
7467
// CHECK: }
7568

76-
// Test ObjC base class
77-
78-
class Hoozit : Gizmo {
79-
// Overrides Gizmo.frob
80-
override func frob() {}
81-
// Overrides Gizmo.funge
82-
override func funge() {}
83-
84-
func anse() {}
85-
func incorrige() {}
86-
}
87-
88-
// Entries only exist for native Swift methods
89-
90-
// CHECK: sil_vtable Hoozit {
91-
// CHECK-NEXT: #Hoozit.anse!1: {{.*}} : _T07vtables6HoozitC4anse{{[_0-9a-zA-Z]*}}F
92-
// CHECK-NEXT: #Hoozit.incorrige!1: {{.*}} : _T07vtables6HoozitC9incorrige{{[_0-9a-zA-Z]*}}F
93-
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> () -> Hoozit! : _T07vtables6HoozitCSQyACGycfc
94-
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> (Int) -> Hoozit! : _T07vtables6HoozitCSQyACGSi7bellsOn_tcfc
95-
// CHECK-NEXT: #Hoozit.deinit!deallocator: _T07vtables6HoozitCfD
96-
// CHECK-NEXT: }
97-
98-
class Wotsit : Hoozit {
99-
override func funge() {}
100-
override func incorrige() {}
101-
}
102-
103-
// CHECK: sil_vtable Wotsit {
104-
// CHECK-NEXT: #Hoozit.anse!1: {{.*}} : _T07vtables6HoozitC4anse{{[_0-9a-zA-Z]*}}F
105-
// CHECK-NEXT: #Hoozit.incorrige!1: {{.*}} : _T07vtables6WotsitC9incorrige{{[_0-9a-zA-Z]*}}F
106-
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> () -> Hoozit! : _T07vtables6WotsitCSQyACGycfc
107-
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> (Int) -> Hoozit! : _T07vtables6WotsitCSQyACGSi7bellsOn_tcfc
108-
// CHECK-NEXT: #Wotsit.deinit!deallocator: _T07vtables6WotsitCfD
109-
// CHECK-NEXT: }
110-
111-
// <rdar://problem/15282548>
112-
// CHECK: sil_vtable Base {
113-
// CHECK: #Base.init!initializer.1: {{.*}} : _T07vtables4BaseC{{[_0-9a-zA-Z]*}}fc
114-
// CHECK: }
115-
// CHECK: sil_vtable Derived {
116-
// CHECK: #Base.init!initializer.1: {{.*}} : _T07vtables7DerivedC{{[_0-9a-zA-Z]*}}fc
117-
// CHECK: }
118-
@objc class Base {}
119-
120-
extension Base {
121-
// note: does not have a vtable slot, because it is from an extension
122-
func identify() -> Int {
123-
return 0
124-
}
125-
}
126-
127-
class Derived : Base {
128-
override func identify() -> Int {
129-
return 1
130-
}
131-
}
132-
133-
13469
// CHECK: sil_vtable RequiredInitDerived {
13570
// CHECK-NEXT: #SimpleInitBase.init!initializer.1: {{.*}} : _T07vtables19RequiredInitDerivedC{{[_0-9a-zA-Z]*}}fc
13671
// CHECK-NEXT #RequiredInitDerived.init!allocator.1: {{.*}} : _TFC7vtables19RequiredInitDerivedC

test/SILGen/vtables_objc.swift

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// RUN: %target-swift-frontend -sdk %S/Inputs -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
2+
3+
// REQUIRES: objc_interop
4+
5+
import gizmo
6+
7+
// Test ObjC base class
8+
9+
class Hoozit : Gizmo {
10+
// Overrides Gizmo.frob
11+
override func frob() {}
12+
// Overrides Gizmo.funge
13+
override func funge() {}
14+
15+
func anse() {}
16+
func incorrige() {}
17+
}
18+
19+
// Entries only exist for native Swift methods
20+
21+
// CHECK: sil_vtable Hoozit {
22+
// CHECK-NEXT: #Hoozit.anse!1: {{.*}} : _T012vtables_objc6HoozitC4anse{{[_0-9a-zA-Z]*}}F
23+
// CHECK-NEXT: #Hoozit.incorrige!1: {{.*}} : _T012vtables_objc6HoozitC9incorrige{{[_0-9a-zA-Z]*}}F
24+
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> () -> Hoozit! : _T012vtables_objc6HoozitCSQyACGycfc
25+
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> (Int) -> Hoozit! : _T012vtables_objc6HoozitCSQyACGSi7bellsOn_tcfc
26+
// CHECK-NEXT: #Hoozit.deinit!deallocator: _T012vtables_objc6HoozitCfD
27+
// CHECK-NEXT: }
28+
29+
class Wotsit : Hoozit {
30+
override func funge() {}
31+
override func incorrige() {}
32+
}
33+
34+
// CHECK: sil_vtable Wotsit {
35+
// CHECK-NEXT: #Hoozit.anse!1: {{.*}} : _T012vtables_objc6HoozitC4anse{{[_0-9a-zA-Z]*}}F
36+
// CHECK-NEXT: #Hoozit.incorrige!1: {{.*}} : _T012vtables_objc6WotsitC9incorrige{{[_0-9a-zA-Z]*}}F
37+
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> () -> Hoozit! : _T012vtables_objc6WotsitCSQyACGycfc
38+
// CHECK-NEXT: #Hoozit.init!initializer.1: (Hoozit.Type) -> (Int) -> Hoozit! : _T012vtables_objc6WotsitCSQyACGSi7bellsOn_tcfc
39+
// CHECK-NEXT: #Wotsit.deinit!deallocator: _T012vtables_objc6WotsitCfD
40+
// CHECK-NEXT: }
41+
42+
// <rdar://problem/15282548>
43+
// CHECK: sil_vtable Base {
44+
// CHECK: #Base.init!initializer.1: {{.*}} : _T012vtables_objc4BaseC{{[_0-9a-zA-Z]*}}fc
45+
// CHECK: }
46+
// CHECK: sil_vtable Derived {
47+
// CHECK: #Base.init!initializer.1: {{.*}} : _T012vtables_objc7DerivedC{{[_0-9a-zA-Z]*}}fc
48+
// CHECK: }
49+
@objc class Base {}
50+
51+
extension Base {
52+
// note: does not have a vtable slot, because it is from an extension
53+
func identify() -> Int {
54+
return 0
55+
}
56+
}
57+
58+
class Derived : Base {
59+
override func identify() -> Int {
60+
return 1
61+
}
62+
}

0 commit comments

Comments
 (0)