SILGen: Add linkage to SILDefaultWitnessTable

This is only used in the verifier, to ensure that default witness
thunks are suffiently visible.

Also this patch removes the asserts enforcing that only resilient
protocols have a default witness table. This will change in an
upcoming patch, and in this patch is necessary for the test to work.
This commit is contained in:
Slava Pestov
2016-03-17 01:31:13 -07:00
parent 25319d9d4b
commit b13457daaa
9 changed files with 75 additions and 35 deletions

View File

@@ -190,23 +190,17 @@ SILModule::lookUpDefaultWitnessTable(const ProtocolDecl *Protocol) {
auto found = DefaultWitnessTableMap.find(Protocol);
if (found == DefaultWitnessTableMap.end()) {
assert(Protocol->hasFixedLayout() &&
"Resilient protocol must have a default witness table");
return nullptr;
}
assert(!Protocol->hasFixedLayout() &&
"Fixed-layout protocol cannot have a default witness table");
return found->second;
}
SILDefaultWitnessTable *
SILModule::createDefaultWitnessTableDeclaration(const ProtocolDecl *Protocol) {
assert(!Protocol->hasFixedLayout() &&
"Fixed-layout protocol cannot have a default witness table");
return SILDefaultWitnessTable::create(*this, Protocol);
SILModule::createDefaultWitnessTableDeclaration(const ProtocolDecl *Protocol,
SILLinkage Linkage) {
return SILDefaultWitnessTable::create(*this, Linkage, Protocol);
}
SILFunction *SILModule::getOrCreateFunction(SILLocation loc,