2323#include " Scope.h"
2424#include " swift/AST/ASTMangler.h"
2525#include " swift/AST/GenericEnvironment.h"
26- #include " swift/AST/ProtocolConformance.h"
2726#include " swift/AST/PrettyStackTrace.h"
2827#include " swift/AST/PropertyWrappers.h"
28+ #include " swift/AST/ProtocolConformance.h"
2929#include " swift/AST/SourceFile.h"
3030#include " swift/AST/SubstitutionMap.h"
3131#include " swift/AST/TypeMemberVisitor.h"
@@ -260,6 +260,8 @@ class SILGenVTable : public SILVTableVisitor<SILGenVTable> {
260260 }
261261
262262 void emitVTable () {
263+ PrettyStackTraceDecl (" silgen emitVTable" , theClass);
264+
263265 // Imported types don't have vtables right now.
264266 if (theClass->hasClangNode ())
265267 return ;
@@ -529,6 +531,11 @@ class SILGenConformance : public SILGenWitnessTable<SILGenConformance> {
529531 PrettyStackTraceConformance trace (" generating SIL witness table" ,
530532 Conformance);
531533
534+ // Check whether the conformance is valid first.
535+ Conformance->resolveValueWitnesses ();
536+ if (Conformance->isInvalid ())
537+ return nullptr ;
538+
532539 auto *proto = Conformance->getProtocol ();
533540 visitProtocolDecl (proto);
534541
@@ -1113,6 +1120,8 @@ class SILGenType : public TypeMemberVisitor<SILGenType> {
11131120
11141121 // / Emit SIL functions for all the members of the type.
11151122 void emitType () {
1123+ PrettyStackTraceDecl (" silgen emitType" , theType);
1124+
11161125 SGM.emitLazyConformancesForType (theType);
11171126
11181127 for (Decl *member : theType->getABIMembers ()) {
@@ -1150,7 +1159,7 @@ class SILGenType : public TypeMemberVisitor<SILGenType> {
11501159 for (auto *conformance : theType->getLocalConformances (
11511160 ConformanceLookupKind::NonInherited)) {
11521161 if (auto *normal = dyn_cast<NormalProtocolConformance>(conformance))
1153- SGM.getWitnessTable (normal);
1162+ ( void ) SGM.getWitnessTable (normal);
11541163 }
11551164 }
11561165
@@ -1287,6 +1296,8 @@ class SILGenExtension : public TypeMemberVisitor<SILGenExtension> {
12871296
12881297 // / Emit SIL functions for all the members of the extension.
12891298 void emitExtension (ExtensionDecl *e) {
1299+ PrettyStackTraceDecl (" silgen emitExtension" , e);
1300+
12901301 // Arguably, we should divert to SILGenType::emitType() here if it's an
12911302 // @_objcImplementation extension, but we don't actually need to do any of
12921303 // the stuff that it currently does.
@@ -1309,7 +1320,7 @@ class SILGenExtension : public TypeMemberVisitor<SILGenExtension> {
13091320 for (auto *conformance : e->getLocalConformances (
13101321 ConformanceLookupKind::All)) {
13111322 if (auto *normal =dyn_cast<NormalProtocolConformance>(conformance))
1312- SGM.getWitnessTable (normal);
1323+ ( void ) SGM.getWitnessTable (normal);
13131324 }
13141325 }
13151326 }
0 commit comments