@@ -340,6 +340,9 @@ class ASTIdentifierLookupTrait;
340
340
// / The on-disk hash table(s) used for DeclContext name lookup.
341
341
struct DeclContextLookupTable ;
342
342
343
+ // / The on-disk hash table(s) used for specialization decls.
344
+ struct LazySpecializationInfoLookupTable ;
345
+
343
346
} // namespace reader
344
347
345
348
} // namespace serialization
@@ -603,21 +606,30 @@ class ASTReader
603
606
llvm::DenseMap<const DeclContext *,
604
607
serialization::reader::DeclContextLookupTable> Lookups;
605
608
609
+ // / Map from decls to specialized decls.
610
+ llvm::DenseMap<const Decl *,
611
+ serialization::reader::LazySpecializationInfoLookupTable>
612
+ SpecializationsLookups;
613
+
606
614
// Updates for visible decls can occur for other contexts than just the
607
615
// TU, and when we read those update records, the actual context may not
608
616
// 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 {
611
619
ModuleFile *Mod;
612
620
const unsigned char *Data;
613
621
};
614
- using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate , 1 >;
622
+ using DeclContextVisibleUpdates = SmallVector<UpdateData , 1 >;
615
623
616
624
// / Updates to the visible declarations of declaration contexts that
617
625
// / haven't been loaded yet.
618
626
llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
619
627
PendingVisibleUpdates;
620
628
629
+ using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
630
+ llvm::DenseMap<serialization::DeclID, SpecializationsUpdate>
631
+ PendingSpecializationsUpdates;
632
+
621
633
// / The set of C++ or Objective-C classes that have forward
622
634
// / declarations that have not yet been linked to their definitions.
623
635
llvm::SmallPtrSet<Decl *, 4 > PendingDefinitions;
@@ -644,6 +656,11 @@ class ASTReader
644
656
llvm::BitstreamCursor &Cursor,
645
657
uint64_t Offset, serialization::DeclID ID);
646
658
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
+
647
664
// / A vector containing identifiers that have already been
648
665
// / loaded.
649
666
// /
@@ -1348,6 +1365,11 @@ class ASTReader
1348
1365
const serialization::reader::DeclContextLookupTable *
1349
1366
getLoadedLookupTables (DeclContext *Primary) const ;
1350
1367
1368
+ // / Get the loaded specializations lookup tables for \p D,
1369
+ // / if any.
1370
+ serialization::reader::LazySpecializationInfoLookupTable *
1371
+ getLoadedSpecializationsLookupTables (const Decl *D);
1372
+
1351
1373
private:
1352
1374
struct ImportedModule {
1353
1375
ModuleFile *Mod;
@@ -1982,6 +2004,12 @@ class ASTReader
1982
2004
unsigned BlockID,
1983
2005
uint64_t *StartOfBlockOffset = nullptr );
1984
2006
2007
+ void LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override ;
2008
+
2009
+ void
2010
+ LoadExternalSpecializations (const Decl *D,
2011
+ ArrayRef<TemplateArgument> TemplateArgs) override ;
2012
+
1985
2013
// / Finds all the visible declarations with a given name.
1986
2014
// / The current implementation of this method just loads the entire
1987
2015
// / lookup table as unmaterialized references.
0 commit comments