@@ -353,6 +353,7 @@ class ASTIdentifierLookupTrait;
353353
354354// / The on-disk hash table(s) used for DeclContext name lookup.
355355struct DeclContextLookupTable ;
356+ struct ModuleLocalLookupTable ;
356357
357358// / The on-disk hash table(s) used for specialization decls.
358359struct LazySpecializationInfoLookupTable ;
@@ -523,9 +524,14 @@ class ASTReader
523524 // / in the chain.
524525 DeclUpdateOffsetsMap DeclUpdateOffsets;
525526
527+ struct LookupBlockOffsets {
528+ uint64_t LexicalOffset;
529+ uint64_t VisibleOffset;
530+ uint64_t ModuleLocalOffset;
531+ };
532+
526533 using DelayedNamespaceOffsetMapTy =
527- llvm::DenseMap<GlobalDeclID, std::pair</* LexicalOffset*/ uint64_t ,
528- /* VisibleOffset*/ uint64_t >>;
534+ llvm::DenseMap<GlobalDeclID, LookupBlockOffsets>;
529535
530536 // / Mapping from global declaration IDs to the lexical and visible block
531537 // / offset for delayed namespace in reduced BMI.
@@ -631,6 +637,9 @@ class ASTReader
631637 // / Map from a DeclContext to its lookup tables.
632638 llvm::DenseMap<const DeclContext *,
633639 serialization::reader::DeclContextLookupTable> Lookups;
640+ llvm::DenseMap<const DeclContext *,
641+ serialization::reader::ModuleLocalLookupTable>
642+ ModuleLocalLookups;
634643
635644 using SpecLookupTableTy =
636645 llvm::DenseMap<const Decl *,
@@ -659,6 +668,8 @@ class ASTReader
659668 // / Updates to the visible declarations of declaration contexts that
660669 // / haven't been loaded yet.
661670 llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> PendingVisibleUpdates;
671+ llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates>
672+ PendingModuleLocalVisibleUpdates;
662673
663674 using SpecializationsUpdate = SmallVector<UpdateData, 1 >;
664675 using SpecializationsUpdateMap =
@@ -696,7 +707,8 @@ class ASTReader
696707 // / Read the record that describes the visible contents of a DC.
697708 bool ReadVisibleDeclContextStorage (ModuleFile &M,
698709 llvm::BitstreamCursor &Cursor,
699- uint64_t Offset, GlobalDeclID ID);
710+ uint64_t Offset, GlobalDeclID ID,
711+ bool IsModuleLocal);
700712
701713 bool ReadSpecializations (ModuleFile &M, llvm::BitstreamCursor &Cursor,
702714 uint64_t Offset, Decl *D, bool IsPartial);
@@ -1132,6 +1144,10 @@ class ASTReader
11321144 // / Number of visible decl contexts read/total.
11331145 unsigned NumVisibleDeclContextsRead = 0 , TotalVisibleDeclContexts = 0 ;
11341146
1147+ // / Number of module local visible decl contexts read/total.
1148+ unsigned NumModuleLocalVisibleDeclContexts = 0 ,
1149+ TotalModuleLocalVisibleDeclContexts = 0 ;
1150+
11351151 // / Total size of modules, in bits, currently loaded
11361152 uint64_t TotalModulesSizeInBits = 0 ;
11371153
@@ -1444,6 +1460,9 @@ class ASTReader
14441460 const serialization::reader::DeclContextLookupTable *
14451461 getLoadedLookupTables (DeclContext *Primary) const ;
14461462
1463+ const serialization::reader::ModuleLocalLookupTable *
1464+ getModuleLocalLookupTables (DeclContext *Primary) const ;
1465+
14471466 // / Get the loaded specializations lookup tables for \p D,
14481467 // / if any.
14491468 serialization::reader::LazySpecializationInfoLookupTable *
@@ -2119,7 +2138,8 @@ class ASTReader
21192138 // / The current implementation of this method just loads the entire
21202139 // / lookup table as unmaterialized references.
21212140 bool FindExternalVisibleDeclsByName (const DeclContext *DC,
2122- DeclarationName Name) override ;
2141+ DeclarationName Name,
2142+ const DeclContext *OriginalDC) override ;
21232143
21242144 // / Read all of the declarations lexically stored in a
21252145 // / declaration context.
@@ -2607,6 +2627,10 @@ inline bool shouldSkipCheckingODR(const Decl *D) {
26072627 (D->isFromGlobalModule () || D->isFromHeaderUnit ());
26082628}
26092629
2630+ // / Calculate a hash value for the primary module name of the given module.
2631+ // / \returns std::nullopt if M is not a C++ standard module.
2632+ std::optional<unsigned > getPrimaryModuleHash (const Module *M);
2633+
26102634} // namespace clang
26112635
26122636#endif // LLVM_CLANG_SERIALIZATION_ASTREADER_H
0 commit comments