@@ -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
@@ -618,20 +621,29 @@ class ASTReader
618621 llvm::DenseMap<const DeclContext *,
619622 serialization::reader::DeclContextLookupTable> Lookups;
620623
624+ // / Map from decls to specialized decls.
625+ llvm::DenseMap<const Decl *,
626+ serialization::reader::LazySpecializationInfoLookupTable>
627+ SpecializationsLookups;
628+
621629 // Updates for visible decls can occur for other contexts than just the
622630 // TU, and when we read those update records, the actual context may not
623631 // be available yet, so have this pending map using the ID as a key. It
624- // will be realized when the context is actually loaded.
625- struct PendingVisibleUpdate {
632+ // will be realized when the data is actually loaded.
633+ struct UpdateData {
626634 ModuleFile *Mod;
627635 const unsigned char *Data;
628636 };
629- using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate , 1 >;
637+ using DeclContextVisibleUpdates = SmallVector<UpdateData , 1 >;
630638
631639 // / Updates to the visible declarations of declaration contexts that
632640 // / haven't been loaded yet.
633641 llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> PendingVisibleUpdates;
634642
643+ using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
644+ llvm::DenseMap<GlobalDeclID, SpecializationsUpdate>
645+ PendingSpecializationsUpdates;
646+
635647 // / The set of C++ or Objective-C classes that have forward
636648 // / declarations that have not yet been linked to their definitions.
637649 llvm::SmallPtrSet<Decl *, 4 > PendingDefinitions;
@@ -658,6 +670,11 @@ class ASTReader
658670 llvm::BitstreamCursor &Cursor,
659671 uint64_t Offset, GlobalDeclID ID);
660672
673+ bool ReadSpecializations (ModuleFile &M, llvm::BitstreamCursor &Cursor,
674+ uint64_t Offset, Decl *D);
675+ void AddSpecializations (const Decl *D, const unsigned char *Data,
676+ ModuleFile &M);
677+
661678 // / A vector containing identifiers that have already been
662679 // / loaded.
663680 // /
@@ -1360,6 +1377,11 @@ class ASTReader
13601377 const serialization::reader::DeclContextLookupTable *
13611378 getLoadedLookupTables (DeclContext *Primary) const ;
13621379
1380+ // / Get the loaded specializations lookup tables for \p D,
1381+ // / if any.
1382+ serialization::reader::LazySpecializationInfoLookupTable *
1383+ getLoadedSpecializationsLookupTables (const Decl *D);
1384+
13631385private:
13641386 struct ImportedModule {
13651387 ModuleFile *Mod;
@@ -1989,6 +2011,12 @@ class ASTReader
19892011 unsigned BlockID,
19902012 uint64_t *StartOfBlockOffset = nullptr );
19912013
2014+ void LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override ;
2015+
2016+ void
2017+ LoadExternalSpecializations (const Decl *D,
2018+ ArrayRef<TemplateArgument> TemplateArgs) override ;
2019+
19922020 // / Finds all the visible declarations with a given name.
19932021 // / The current implementation of this method just loads the entire
19942022 // / lookup table as unmaterialized references.
0 commit comments