Skip to content

Commit c165811

Browse files
committed
IRGen: Don't try to bind witness tables for archetype protocol requirements that don't need them.
Fixes rdar://problem/24568361.
1 parent 2c62011 commit c165811

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,9 @@ void WitnessTableBuilder::bindArchetypes(IRGenFunction &IGF,
21582158
// be stored in the private section of the witness table.
21592159
SmallVector<llvm::Value*, 4> archetypeWitnessTables;
21602160
for (auto protocol : archetype->getConformsTo()) {
2161+
if (!Lowering::TypeConverter::protocolRequiresWitnessTable(protocol))
2162+
continue;
2163+
21612164
llvm::Value *wtable;
21622165
if (auto fulfillment =
21632166
fulfillments.getWitnessTable(CanType(archetype), protocol)) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-swift-frontend -emit-ir -verify %s
2+
3+
public struct TestGeneratorCrashy <Key: AnyObject, Value: AnyObject> {
4+
public mutating func next() -> (Key, Value)? {
5+
return nil
6+
}
7+
}
8+
9+
extension TestGeneratorCrashy: GeneratorType {
10+
}

0 commit comments

Comments
 (0)