Skip to content

Commit 60eed5e

Browse files
authored
Merge pull request #8257 from eeckstein/fix-wt-linkage
2 parents 8887217 + 7dba148 commit 60eed5e

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,11 @@ bool LinkEntity::isFragile(IRGenModule &IGM) const {
12641264

12651265
case Kind::ReflectionAssociatedTypeDescriptor:
12661266
case Kind::ReflectionSuperclassDescriptor:
1267+
case Kind::AssociatedTypeMetadataAccessFunction:
1268+
case Kind::AssociatedTypeWitnessTableAccessFunction:
1269+
case Kind::GenericProtocolWitnessTableCache:
1270+
case Kind::GenericProtocolWitnessTableInstantiationFunction:
1271+
case Kind::ObjCClassRef:
12671272
return false;
12681273

12691274
default:

test/IRGen/generic_wt_linkage.sil

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// RUN: %target-swift-frontend %s -module-name=test -emit-ir | %FileCheck %s
2+
3+
sil_stage canonical
4+
5+
import Builtin
6+
import Swift
7+
import SwiftShims
8+
9+
protocol P {
10+
}
11+
12+
struct PBox<T> where T : P {
13+
init()
14+
}
15+
16+
protocol HasSimpleAssoc {
17+
associatedtype Assoc
18+
}
19+
20+
protocol DerivedFromSimpleAssoc : HasSimpleAssoc {
21+
}
22+
23+
struct GenericComputed<T> : DerivedFromSimpleAssoc where T : P {
24+
typealias Assoc = PBox<T>
25+
init()
26+
}
27+
28+
sil_witness_table shared [fragile] <T where T : P> GenericComputed<T>: DerivedFromSimpleAssoc module nix {
29+
base_protocol HasSimpleAssoc: <T where T : P> GenericComputed<T>: HasSimpleAssoc module nix
30+
}
31+
32+
sil_witness_table shared [fragile] <T where T : P> GenericComputed<T>: HasSimpleAssoc module nix {
33+
associated_type Assoc: PBox<T>
34+
}
35+
36+
sil_default_witness_table hidden P {
37+
}
38+
39+
sil_default_witness_table hidden HasSimpleAssoc {
40+
no_default
41+
}
42+
43+
sil_default_witness_table hidden DerivedFromSimpleAssoc {
44+
no_default
45+
}
46+
47+
// CHECK: @_T04test15GenericComputedVyxGAA22DerivedFromSimpleAssocA2A1PRzlWG = internal global
48+
// CHECK: define internal void @_T04test15GenericComputedVyxGAA22DerivedFromSimpleAssocA2A1PRzlWI
49+
50+

0 commit comments

Comments
 (0)