@@ -7452,27 +7452,39 @@ bool SILParserState::parseSILVTable(Parser &P) {
7452
7452
nullptr , nullptr , VTableState, M))
7453
7453
return true ;
7454
7454
7455
- // Parse the class name.
7456
- Identifier Name;
7457
- SourceLoc Loc;
7458
- if (VTableState.parseSILIdentifier (Name, Loc,
7459
- diag::expected_sil_value_name))
7460
- return true ;
7461
7455
7462
- // Find the class decl.
7463
- llvm::PointerUnion<ValueDecl*, ModuleDecl *> Res =
7464
- lookupTopDecl (P, Name, /* typeLookup= */ true );
7465
- assert (Res. is <ValueDecl*>() && " Class look-up should return a Decl " );
7466
- ValueDecl *VD = Res. get <ValueDecl*>() ;
7467
- if (!VD) {
7468
- P. diagnose (Loc, diag::sil_vtable_class_not_found, Name);
7469
- return true ;
7470
- }
7456
+ ClassDecl *theClass = nullptr ;
7457
+ SILType specializedClassTy;
7458
+ if (P. Tok . isNot (tok::sil_dollar)) {
7459
+ // Parse the class name.
7460
+ Identifier Name ;
7461
+ SourceLoc Loc;
7462
+ if (VTableState. parseSILIdentifier (Name, Loc,
7463
+ diag::expected_sil_value_name))
7464
+ return true ;
7471
7465
7472
- auto *theClass = dyn_cast<ClassDecl>(VD);
7473
- if (!theClass) {
7474
- P.diagnose (Loc, diag::sil_vtable_class_not_found, Name);
7475
- return true ;
7466
+ // Find the class decl.
7467
+ llvm::PointerUnion<ValueDecl*, ModuleDecl *> Res =
7468
+ lookupTopDecl (P, Name, /* typeLookup=*/ true );
7469
+ assert (Res.is <ValueDecl*>() && " Class look-up should return a Decl" );
7470
+ ValueDecl *VD = Res.get <ValueDecl*>();
7471
+ if (!VD) {
7472
+ P.diagnose (Loc, diag::sil_vtable_class_not_found, Name);
7473
+ return true ;
7474
+ }
7475
+
7476
+ theClass = dyn_cast<ClassDecl>(VD);
7477
+ if (!theClass) {
7478
+ P.diagnose (Loc, diag::sil_vtable_class_not_found, Name);
7479
+ return true ;
7480
+ }
7481
+ } else {
7482
+ if (SILParser (P).parseSILType (specializedClassTy))
7483
+ return true ;
7484
+ theClass = specializedClassTy.getClassOrBoundGenericClass ();
7485
+ if (!theClass) {
7486
+ return true ;
7487
+ }
7476
7488
}
7477
7489
7478
7490
SourceLoc LBraceLoc = P.Tok .getLoc ();
@@ -7540,7 +7552,7 @@ bool SILParserState::parseSILVTable(Parser &P) {
7540
7552
P.parseMatchingToken (tok::r_brace, RBraceLoc, diag::expected_sil_rbrace,
7541
7553
LBraceLoc);
7542
7554
7543
- SILVTable::create (M, theClass, Serialized, vtableEntries);
7555
+ SILVTable::create (M, theClass, specializedClassTy, Serialized, vtableEntries);
7544
7556
return false ;
7545
7557
}
7546
7558
0 commit comments