@@ -352,6 +352,9 @@ class ASTIdentifierLookupTrait;
352352// / The on-disk hash table(s) used for DeclContext name lookup.
353353struct DeclContextLookupTable ;
354354
355+ // / The on-disk hash table(s) used for specialization decls.
356+ struct LazySpecializationInfoLookupTable ;
357+
355358} // namespace reader
356359
357360} // namespace serialization
@@ -630,20 +633,29 @@ class ASTReader
630633 llvm::DenseMap<const DeclContext *,
631634 serialization::reader::DeclContextLookupTable> Lookups;
632635
636+ // / Map from decls to specialized decls.
637+ llvm::DenseMap<const Decl *,
638+ serialization::reader::LazySpecializationInfoLookupTable>
639+ SpecializationsLookups;
640+
633641 // Updates for visible decls can occur for other contexts than just the
634642 // TU, and when we read those update records, the actual context may not
635643 // be available yet, so have this pending map using the ID as a key. It
636- // will be realized when the context is actually loaded.
637- struct PendingVisibleUpdate {
644+ // will be realized when the data is actually loaded.
645+ struct UpdateData {
638646 ModuleFile *Mod;
639647 const unsigned char *Data;
640648 };
641- using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate , 1 >;
649+ using DeclContextVisibleUpdates = SmallVector<UpdateData , 1 >;
642650
643651 // / Updates to the visible declarations of declaration contexts that
644652 // / haven't been loaded yet.
645653 llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> PendingVisibleUpdates;
646654
655+ using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
656+ llvm::DenseMap<GlobalDeclID, SpecializationsUpdate>
657+ PendingSpecializationsUpdates;
658+
647659 // / The set of C++ or Objective-C classes that have forward
648660 // / declarations that have not yet been linked to their definitions.
649661 llvm::SmallPtrSet<Decl *, 4 > PendingDefinitions;
@@ -676,6 +688,11 @@ class ASTReader
676688 llvm::BitstreamCursor &Cursor,
677689 uint64_t Offset, GlobalDeclID ID);
678690
691+ bool ReadSpecializations (ModuleFile &M, llvm::BitstreamCursor &Cursor,
692+ uint64_t Offset, Decl *D);
693+ void AddSpecializations (const Decl *D, const unsigned char *Data,
694+ ModuleFile &M);
695+
679696 // / A vector containing identifiers that have already been
680697 // / loaded.
681698 // /
@@ -1378,6 +1395,11 @@ class ASTReader
13781395 const serialization::reader::DeclContextLookupTable *
13791396 getLoadedLookupTables (DeclContext *Primary) const ;
13801397
1398+ // / Get the loaded specializations lookup tables for \p D,
1399+ // / if any.
1400+ serialization::reader::LazySpecializationInfoLookupTable *
1401+ getLoadedSpecializationsLookupTables (const Decl *D);
1402+
13811403private:
13821404 struct ImportedModule {
13831405 ModuleFile *Mod;
@@ -2035,6 +2057,12 @@ class ASTReader
20352057 unsigned BlockID,
20362058 uint64_t *StartOfBlockOffset = nullptr );
20372059
2060+ void LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override ;
2061+
2062+ void
2063+ LoadExternalSpecializations (const Decl *D,
2064+ ArrayRef<TemplateArgument> TemplateArgs) override ;
2065+
20382066 // / Finds all the visible declarations with a given name.
20392067 // / The current implementation of this method just loads the entire
20402068 // / lookup table as unmaterialized references.
0 commit comments