Skip to content

Commit 983e077

Browse files
committed
SIL: Remove SILModule::createWitnessTableDeclaration()
The code becomes simpler if we fold it into its only caller.
1 parent a3b266e commit 983e077

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

include/swift/SIL/SILModule.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,6 @@ class SILModule {
570570
/// hierarchy of \p Class.
571571
SILFunction *lookUpFunctionInVTable(ClassDecl *Class, SILDeclRef Member);
572572

573-
// Given a protocol conformance, attempt to create a witness table declaration
574-
// for it.
575-
SILWitnessTable *createWitnessTableDeclaration(const ProtocolConformance *C);
576-
577573
// Given a protocol, attempt to create a default witness table declaration
578574
// for it.
579575
SILDefaultWitnessTable *

lib/SIL/SILModule.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,6 @@ void SILModule::deallocateInst(SILInstruction *I) {
143143
AlignedFree(I);
144144
}
145145

146-
SILWitnessTable *
147-
SILModule::createWitnessTableDeclaration(const ProtocolConformance *C) {
148-
// If we are passed in a null conformance (a valid value), just return nullptr
149-
// since we cannot map a witness table to it.
150-
if (!C)
151-
return nullptr;
152-
153-
// Extract the root conformance.
154-
auto rootC = C->getRootConformance();
155-
auto linkage = getLinkageForProtocolConformance(rootC, NotForDefinition);
156-
return SILWitnessTable::create(*this, linkage,
157-
const_cast<RootProtocolConformance *>(rootC));
158-
}
159-
160146
SILWitnessTable *
161147
SILModule::lookUpWitnessTable(ProtocolConformanceRef C,
162148
bool deserializeLazily) {
@@ -198,7 +184,9 @@ SILModule::lookUpWitnessTable(const ProtocolConformance *C,
198184
if (!deserializeLazily)
199185
return nullptr;
200186

201-
wtable = createWitnessTableDeclaration(C);
187+
auto linkage = getLinkageForProtocolConformance(rootC, NotForDefinition);
188+
wtable = SILWitnessTable::create(*this, linkage,
189+
const_cast<RootProtocolConformance *>(rootC));
202190
} else {
203191
wtable = found->second;
204192
assert(wtable != nullptr && "Should never map a conformance to a null witness"

0 commit comments

Comments
 (0)