@@ -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
@@ -605,20 +608,29 @@ class ASTReader
605608 llvm::DenseMap<const DeclContext *,
606609 serialization::reader::DeclContextLookupTable> Lookups;
607610
611+ // / Map from decls to specialized decls.
612+ llvm::DenseMap<const Decl *,
613+ serialization::reader::LazySpecializationInfoLookupTable>
614+ SpecializationsLookups;
615+
608616 // Updates for visible decls can occur for other contexts than just the
609617 // TU, and when we read those update records, the actual context may not
610618 // be available yet, so have this pending map using the ID as a key. It
611- // will be realized when the context is actually loaded.
612- struct PendingVisibleUpdate {
619+ // will be realized when the data is actually loaded.
620+ struct UpdateData {
613621 ModuleFile *Mod;
614622 const unsigned char *Data;
615623 };
616- using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate , 1 >;
624+ using DeclContextVisibleUpdates = SmallVector<UpdateData , 1 >;
617625
618626 // / Updates to the visible declarations of declaration contexts that
619627 // / haven't been loaded yet.
620628 llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> PendingVisibleUpdates;
621629
630+ using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
631+ llvm::DenseMap<GlobalDeclID, SpecializationsUpdate>
632+ PendingSpecializationsUpdates;
633+
622634 // / The set of C++ or Objective-C classes that have forward
623635 // / declarations that have not yet been linked to their definitions.
624636 llvm::SmallPtrSet<Decl *, 4 > PendingDefinitions;
@@ -645,6 +657,11 @@ class ASTReader
645657 llvm::BitstreamCursor &Cursor,
646658 uint64_t Offset, GlobalDeclID ID);
647659
660+ bool ReadSpecializations (ModuleFile &M, llvm::BitstreamCursor &Cursor,
661+ uint64_t Offset, Decl *D);
662+ void AddSpecializations (const Decl *D, const unsigned char *Data,
663+ ModuleFile &M);
664+
648665 // / A vector containing identifiers that have already been
649666 // / loaded.
650667 // /
@@ -1339,6 +1356,11 @@ class ASTReader
13391356 const serialization::reader::DeclContextLookupTable *
13401357 getLoadedLookupTables (DeclContext *Primary) const ;
13411358
1359+ // / Get the loaded specializations lookup tables for \p D,
1360+ // / if any.
1361+ serialization::reader::LazySpecializationInfoLookupTable *
1362+ getLoadedSpecializationsLookupTables (const Decl *D);
1363+
13421364private:
13431365 struct ImportedModule {
13441366 ModuleFile *Mod;
@@ -1986,6 +2008,12 @@ class ASTReader
19862008 unsigned BlockID,
19872009 uint64_t *StartOfBlockOffset = nullptr );
19882010
2011+ void LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override ;
2012+
2013+ void
2014+ LoadExternalSpecializations (const Decl *D,
2015+ ArrayRef<TemplateArgument> TemplateArgs) override ;
2016+
19892017 // / Finds all the visible declarations with a given name.
19902018 // / The current implementation of this method just loads the entire
19912019 // / lookup table as unmaterialized references.
0 commit comments