SIL: Remove linkage parameter from SILModule::createWitnessTableDeclaration()

All callers were doing the same thing here, so move it inside the
function. Also, change getRootNormalConformance(), which is deprecated,
to getRootConformance().
This commit is contained in:
Slava Pestov
2018-12-20 15:17:34 -05:00
parent ff47c303ad
commit 39c93b9f85
4 changed files with 7 additions and 11 deletions

View File

@@ -572,8 +572,7 @@ public:
// Given a protocol conformance, attempt to create a witness table declaration
// for it.
SILWitnessTable *
createWitnessTableDeclaration(ProtocolConformance *C, SILLinkage linkage);
SILWitnessTable *createWitnessTableDeclaration(const ProtocolConformance *C);
// Given a protocol, attempt to create a default witness table declaration
// for it.

View File

@@ -217,9 +217,7 @@ void SILLinkerVisitor::visitProtocolConformance(
// If we don't find any witness table for the conformance, bail and return
// false.
if (!WT) {
Mod.createWitnessTableDeclaration(
C, getLinkageForProtocolConformance(
C->getRootNormalConformance(), NotForDefinition));
Mod.createWitnessTableDeclaration(C);
// Adding the declaration may allow us to now deserialize the body.
// Force the body if we must deserialize this witness table.

View File

@@ -317,9 +317,7 @@ static void declareWitnessTable(SILModule &Mod,
if (conformanceRef.isAbstract()) return;
auto C = conformanceRef.getConcrete();
if (!Mod.lookUpWitnessTable(C, false))
Mod.createWitnessTableDeclaration(C,
getLinkageForProtocolConformance(C->getRootNormalConformance(),
NotForDefinition));
Mod.createWitnessTableDeclaration(C);
}
AllocExistentialBoxInst *AllocExistentialBoxInst::create(

View File

@@ -144,8 +144,7 @@ void SILModule::deallocateInst(SILInstruction *I) {
}
SILWitnessTable *
SILModule::createWitnessTableDeclaration(ProtocolConformance *C,
SILLinkage linkage) {
SILModule::createWitnessTableDeclaration(const ProtocolConformance *C) {
// If we are passed in a null conformance (a valid value), just return nullptr
// since we cannot map a witness table to it.
if (!C)
@@ -153,7 +152,9 @@ SILModule::createWitnessTableDeclaration(ProtocolConformance *C,
// Extract the root conformance.
auto rootC = C->getRootConformance();
return SILWitnessTable::create(*this, linkage, rootC);
auto linkage = getLinkageForProtocolConformance(rootC, NotForDefinition);
return SILWitnessTable::create(*this, linkage,
const_cast<RootProtocolConformance *>(rootC));
}
SILWitnessTable *