@@ -353,6 +353,9 @@ class ASTIdentifierLookupTrait;
353353// / The on-disk hash table(s) used for DeclContext name lookup.
354354struct DeclContextLookupTable ;
355355
356+ // / The on-disk hash table(s) used for specialization decls.
357+ struct LazySpecializationInfoLookupTable ;
358+
356359} // namespace reader
357360
358361} // namespace serialization
@@ -631,20 +634,29 @@ class ASTReader
631634 llvm::DenseMap<const DeclContext *,
632635 serialization::reader::DeclContextLookupTable> Lookups;
633636
637+ // / Map from decls to specialized decls.
638+ llvm::DenseMap<const Decl *,
639+ serialization::reader::LazySpecializationInfoLookupTable>
640+ SpecializationsLookups;
641+
634642 // Updates for visible decls can occur for other contexts than just the
635643 // TU, and when we read those update records, the actual context may not
636644 // be available yet, so have this pending map using the ID as a key. It
637- // will be realized when the context is actually loaded.
638- struct PendingVisibleUpdate {
645+ // will be realized when the data is actually loaded.
646+ struct UpdateData {
639647 ModuleFile *Mod;
640648 const unsigned char *Data;
641649 };
642- using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate , 1 >;
650+ using DeclContextVisibleUpdates = SmallVector<UpdateData , 1 >;
643651
644652 // / Updates to the visible declarations of declaration contexts that
645653 // / haven't been loaded yet.
646654 llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> PendingVisibleUpdates;
647655
656+ using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
657+ llvm::DenseMap<GlobalDeclID, SpecializationsUpdate>
658+ PendingSpecializationsUpdates;
659+
648660 // / The set of C++ or Objective-C classes that have forward
649661 // / declarations that have not yet been linked to their definitions.
650662 llvm::SmallPtrSet<Decl *, 4 > PendingDefinitions;
@@ -677,6 +689,11 @@ class ASTReader
677689 llvm::BitstreamCursor &Cursor,
678690 uint64_t Offset, GlobalDeclID ID);
679691
692+ bool ReadSpecializations (ModuleFile &M, llvm::BitstreamCursor &Cursor,
693+ uint64_t Offset, Decl *D);
694+ void AddSpecializations (const Decl *D, const unsigned char *Data,
695+ ModuleFile &M);
696+
680697 // / A vector containing identifiers that have already been
681698 // / loaded.
682699 // /
@@ -1379,6 +1396,11 @@ class ASTReader
13791396 const serialization::reader::DeclContextLookupTable *
13801397 getLoadedLookupTables (DeclContext *Primary) const ;
13811398
1399+ // / Get the loaded specializations lookup tables for \p D,
1400+ // / if any.
1401+ serialization::reader::LazySpecializationInfoLookupTable *
1402+ getLoadedSpecializationsLookupTables (const Decl *D);
1403+
13821404private:
13831405 struct ImportedModule {
13841406 ModuleFile *Mod;
@@ -2036,6 +2058,12 @@ class ASTReader
20362058 unsigned BlockID,
20372059 uint64_t *StartOfBlockOffset = nullptr );
20382060
2061+ void LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override ;
2062+
2063+ void
2064+ LoadExternalSpecializations (const Decl *D,
2065+ ArrayRef<TemplateArgument> TemplateArgs) override ;
2066+
20392067 // / Finds all the visible declarations with a given name.
20402068 // / The current implementation of this method just loads the entire
20412069 // / lookup table as unmaterialized references.
0 commit comments