mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix a SourceKitCrash in the VTableSpecializer pass
Replace the assert-check if a vtable is available with a regular error message. This cannot occur in regular builds - only if built with embedded swift and without wmo. The command line compiler prevents this combination, but it can happen in SourceKit. rdar://130167087
This commit is contained in:
@@ -165,9 +165,12 @@ SILVTable *swift::specializeVTableForType(SILType classTy, SILModule &module,
|
||||
ClassDecl *classDecl = genClassTy->getDecl();
|
||||
SILVTable *origVtable = module.lookUpVTable(classDecl);
|
||||
if (!origVtable) {
|
||||
llvm::errs() << "No vtable available for "
|
||||
<< genClassTy->getDecl()->getName() << '\n';
|
||||
llvm::report_fatal_error("no vtable");
|
||||
// This cannot occur in regular builds - only if built without wmo, which
|
||||
// can only happen in SourceKit.
|
||||
// Not ideal, but better than a SourceKit crash.
|
||||
module.getASTContext().Diags.diagnose(
|
||||
SourceLoc(), diag::cannot_specialize_class, classTy.getASTType());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SubstitutionMap subs = astType->getContextSubstitutionMap(
|
||||
|
||||
Reference in New Issue
Block a user