@@ -340,6 +340,9 @@ class ASTIdentifierLookupTrait;
340340// / The on-disk hash table(s) used for DeclContext name lookup.
341341struct DeclContextLookupTable ;
342342
343+ // / The on-disk hash table(s) used for specialization decls.
344+ struct LazySpecializationInfoLookupTable ;
345+
343346} // namespace reader
344347
345348} // namespace serialization
@@ -603,21 +606,30 @@ class ASTReader
603606 llvm::DenseMap<const DeclContext *,
604607 serialization::reader::DeclContextLookupTable> Lookups;
605608
609+ // / Map from decls to specialized decls.
610+ llvm::DenseMap<const Decl *,
611+ serialization::reader::LazySpecializationInfoLookupTable>
612+ SpecializationsLookups;
613+
606614 // Updates for visible decls can occur for other contexts than just the
607615 // TU, and when we read those update records, the actual context may not
608616 // be available yet, so have this pending map using the ID as a key. It
609- // will be realized when the context is actually loaded.
610- struct PendingVisibleUpdate {
617+ // will be realized when the data is actually loaded.
618+ struct UpdateData {
611619 ModuleFile *Mod;
612620 const unsigned char *Data;
613621 };
614- using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate , 1 >;
622+ using DeclContextVisibleUpdates = SmallVector<UpdateData , 1 >;
615623
616624 // / Updates to the visible declarations of declaration contexts that
617625 // / haven't been loaded yet.
618626 llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
619627 PendingVisibleUpdates;
620628
629+ using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
630+ llvm::DenseMap<serialization::DeclID, SpecializationsUpdate>
631+ PendingSpecializationsUpdates;
632+
621633 // / The set of C++ or Objective-C classes that have forward
622634 // / declarations that have not yet been linked to their definitions.
623635 llvm::SmallPtrSet<Decl *, 4 > PendingDefinitions;
@@ -644,6 +656,11 @@ class ASTReader
644656 llvm::BitstreamCursor &Cursor,
645657 uint64_t Offset, serialization::DeclID ID);
646658
659+ bool ReadSpecializations (ModuleFile &M, llvm::BitstreamCursor &Cursor,
660+ uint64_t Offset, Decl *D);
661+ void AddSpecializations (const Decl *D, const unsigned char *Data,
662+ ModuleFile &M);
663+
647664 // / A vector containing identifiers that have already been
648665 // / loaded.
649666 // /
@@ -1348,6 +1365,11 @@ class ASTReader
13481365 const serialization::reader::DeclContextLookupTable *
13491366 getLoadedLookupTables (DeclContext *Primary) const ;
13501367
1368+ // / Get the loaded specializations lookup tables for \p D,
1369+ // / if any.
1370+ serialization::reader::LazySpecializationInfoLookupTable *
1371+ getLoadedSpecializationsLookupTables (const Decl *D);
1372+
13511373private:
13521374 struct ImportedModule {
13531375 ModuleFile *Mod;
@@ -1982,6 +2004,12 @@ class ASTReader
19822004 unsigned BlockID,
19832005 uint64_t *StartOfBlockOffset = nullptr );
19842006
2007+ void LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override ;
2008+
2009+ void
2010+ LoadExternalSpecializations (const Decl *D,
2011+ ArrayRef<TemplateArgument> TemplateArgs) override ;
2012+
19852013 // / Finds all the visible declarations with a given name.
19862014 // / The current implementation of this method just loads the entire
19872015 // / lookup table as unmaterialized references.
0 commit comments