@@ -618,17 +618,13 @@ DeclContextID Serializer::addDeclContextRef(const DeclContext *DC) {
618
618
return id;
619
619
}
620
620
621
- DeclID Serializer::addDeclRef (const Decl *D, bool forceSerialization,
622
- bool allowTypeAliasXRef) {
621
+ DeclID Serializer::addDeclRef (const Decl *D, bool allowTypeAliasXRef) {
623
622
if (!D)
624
623
return 0 ;
625
624
626
- DeclIDAndForce &id = DeclAndTypeIDs[D];
627
- if (id.first != 0 ) {
628
- if (forceSerialization && !id.second )
629
- id.second = true ;
630
- return id.first ;
631
- }
625
+ DeclID &id = DeclAndTypeIDs[D];
626
+ if (id != 0 )
627
+ return id;
632
628
633
629
assert ((!isDeclXRef (D) || isa<ValueDecl>(D) || isa<OperatorDecl>(D) ||
634
630
isa<PrecedenceGroupDecl>(D)) &&
@@ -642,9 +638,9 @@ DeclID Serializer::addDeclRef(const Decl *D, bool forceSerialization,
642
638
D->getModuleContext () == M) &&
643
639
" cannot cross-reference typealiases directly (use the NameAliasType)" );
644
640
645
- id = { ++LastDeclID, forceSerialization } ;
641
+ id = ++LastDeclID;
646
642
DeclsAndTypesToWrite.push (D);
647
- return id. first ;
643
+ return id;
648
644
}
649
645
650
646
serialization::TypeID Serializer::addTypeRef (Type ty) {
@@ -657,12 +653,12 @@ serialization::TypeID Serializer::addTypeRef(Type ty) {
657
653
#endif
658
654
659
655
auto &id = DeclAndTypeIDs[ty];
660
- if (id. first != 0 )
661
- return id. first ;
656
+ if (id != 0 )
657
+ return id;
662
658
663
- id = { ++LastTypeID, true } ;
659
+ id = ++LastTypeID;
664
660
DeclsAndTypesToWrite.push (ty);
665
- return id. first ;
661
+ return id;
666
662
}
667
663
668
664
IdentifierID Serializer::addDeclBaseNameRef (DeclBaseName ident) {
@@ -1577,8 +1573,7 @@ void Serializer::writeNormalConformance(
1577
1573
Type type, TypeDecl *typeDecl) {
1578
1574
data.push_back (addDeclRef (assocType));
1579
1575
data.push_back (addTypeRef (type));
1580
- data.push_back (addDeclRef (typeDecl, /* forceSerialization*/ false ,
1581
- /* allowTypeAliasXRef*/ true ));
1576
+ data.push_back (addDeclRef (typeDecl, /* allowTypeAliasXRef*/ true ));
1582
1577
++numTypeWitnesses;
1583
1578
return false ;
1584
1579
});
@@ -2171,18 +2166,6 @@ DEF_VERIFY_ATTR(Destructor)
2171
2166
static void verifyAttrSerializable (const Decl *D) {}
2172
2167
#endif
2173
2168
2174
- static bool isForced (const Decl *D,
2175
- const llvm::DenseMap<Serializer::DeclTypeUnion,
2176
- Serializer::DeclIDAndForce> &table) {
2177
- if (table.lookup (D).second )
2178
- return true ;
2179
- for (const DeclContext *DC = D->getDeclContext (); !DC->isModuleScopeContext ();
2180
- DC = DC->getParent ())
2181
- if (table.lookup (getDeclForContext (DC)).second )
2182
- return true ;
2183
- return false ;
2184
- }
2185
-
2186
2169
static inline unsigned getOptionalOrZero (const llvm::Optional<unsigned > &X) {
2187
2170
if (X.hasValue ())
2188
2171
return X.getValue ();
@@ -2379,7 +2362,7 @@ bool Serializer::isDeclXRef(const Decl *D) const {
2379
2362
assert (isa<GenericTypeParamDecl>(D) && " unexpected decl kind" );
2380
2363
return false ;
2381
2364
}
2382
- return ! isForced (D, DeclAndTypeIDs) ;
2365
+ return true ;
2383
2366
}
2384
2367
2385
2368
void Serializer::writeDeclContext (const DeclContext *DC) {
@@ -2639,7 +2622,7 @@ void Serializer::writeDecl(const Decl *D) {
2639
2622
2640
2623
PrettyStackTraceDecl trace (" serializing" , D);
2641
2624
2642
- auto id = DeclAndTypeIDs[D]. first ;
2625
+ auto id = DeclAndTypeIDs[D];
2643
2626
assert (id != 0 && " decl or type not referenced properly" );
2644
2627
(void )id;
2645
2628
@@ -3607,7 +3590,7 @@ static TypeAliasDecl *findTypeAliasForBuiltin(ASTContext &Ctx, Type T) {
3607
3590
void Serializer::writeType (Type ty) {
3608
3591
using namespace decls_block ;
3609
3592
3610
- auto id = DeclAndTypeIDs[ty]. first ;
3593
+ auto id = DeclAndTypeIDs[ty];
3611
3594
assert (id != 0 && " type not referenced properly" );
3612
3595
(void )id;
3613
3596
@@ -3635,7 +3618,6 @@ void Serializer::writeType(Type ty) {
3635
3618
unsigned abbrCode = DeclTypeAbbrCodes[BuiltinAliasTypeLayout::Code];
3636
3619
BuiltinAliasTypeLayout::emitRecord (Out, ScratchRecord, abbrCode,
3637
3620
addDeclRef (typeAlias,
3638
- /* forceSerialization*/ false ,
3639
3621
/* allowTypeAliasXRef*/ true ),
3640
3622
TypeID ());
3641
3623
break ;
@@ -3647,9 +3629,7 @@ void Serializer::writeType(Type ty) {
3647
3629
unsigned abbrCode = DeclTypeAbbrCodes[NameAliasTypeLayout::Code];
3648
3630
NameAliasTypeLayout::emitRecord (
3649
3631
Out, ScratchRecord, abbrCode,
3650
- addDeclRef (typeAlias,
3651
- /* forceSerialization*/ false ,
3652
- /* allowTypeAliasXRef*/ true ),
3632
+ addDeclRef (typeAlias, /* allowTypeAliasXRef*/ true ),
3653
3633
addTypeRef (alias->getParent ()),
3654
3634
addTypeRef (alias->getSinglyDesugaredType ()),
3655
3635
addSubstitutionMapRef (alias->getSubstitutionMap ()));
@@ -3968,7 +3948,6 @@ void Serializer::writeType(Type ty) {
3968
3948
unsigned abbrCode = DeclTypeAbbrCodes[UnboundGenericTypeLayout::Code];
3969
3949
UnboundGenericTypeLayout::emitRecord (Out, ScratchRecord, abbrCode,
3970
3950
addDeclRef (generic->getDecl (),
3971
- /* forceSerialization*/ false ,
3972
3951
/* allowTypeAliasXRef*/ true ),
3973
3952
addTypeRef (generic->getParent ()));
3974
3953
break ;
0 commit comments