@@ -501,12 +501,6 @@ class ASTReader
501501 // / = I + 1 has already been loaded.
502502 llvm::PagedVector<Decl *> DeclsLoaded;
503503
504- using GlobalDeclMapType = ContinuousRangeMap<GlobalDeclID, ModuleFile *, 4 >;
505-
506- // / Mapping from global declaration IDs to the module in which the
507- // / declaration resides.
508- GlobalDeclMapType GlobalDeclMap;
509-
510504 using FileOffset = std::pair<ModuleFile *, uint64_t >;
511505 using FileOffsetsTy = SmallVector<FileOffset, 2 >;
512506 using DeclUpdateOffsetsMap = llvm::DenseMap<GlobalDeclID, FileOffsetsTy>;
@@ -589,10 +583,11 @@ class ASTReader
589583
590584 struct FileDeclsInfo {
591585 ModuleFile *Mod = nullptr ;
592- ArrayRef<LocalDeclID > Decls;
586+ ArrayRef<serialization:: unaligned_decl_id_t > Decls;
593587
594588 FileDeclsInfo () = default ;
595- FileDeclsInfo (ModuleFile *Mod, ArrayRef<LocalDeclID> Decls)
589+ FileDeclsInfo (ModuleFile *Mod,
590+ ArrayRef<serialization::unaligned_decl_id_t > Decls)
596591 : Mod(Mod), Decls(Decls) {}
597592 };
598593
@@ -601,11 +596,7 @@ class ASTReader
601596
602597 // / An array of lexical contents of a declaration context, as a sequence of
603598 // / Decl::Kind, DeclID pairs.
604- using unaligned_decl_id_t =
605- llvm::support::detail::packed_endian_specific_integral<
606- serialization::DeclID, llvm::endianness::native,
607- llvm::support::unaligned>;
608- using LexicalContents = ArrayRef<unaligned_decl_id_t >;
599+ using LexicalContents = ArrayRef<serialization::unaligned_decl_id_t >;
609600
610601 // / Map from a DeclContext to its lexical contents.
611602 llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
@@ -1486,22 +1477,23 @@ class ASTReader
14861477 unsigned ClientLoadCapabilities);
14871478
14881479public:
1489- class ModuleDeclIterator : public llvm ::iterator_adaptor_base<
1490- ModuleDeclIterator, const LocalDeclID *,
1491- std::random_access_iterator_tag, const Decl *,
1492- ptrdiff_t , const Decl *, const Decl *> {
1480+ class ModuleDeclIterator
1481+ : public llvm::iterator_adaptor_base<
1482+ ModuleDeclIterator, const serialization::unaligned_decl_id_t *,
1483+ std::random_access_iterator_tag, const Decl *, ptrdiff_t ,
1484+ const Decl *, const Decl *> {
14931485 ASTReader *Reader = nullptr ;
14941486 ModuleFile *Mod = nullptr ;
14951487
14961488 public:
14971489 ModuleDeclIterator () : iterator_adaptor_base(nullptr ) {}
14981490
14991491 ModuleDeclIterator (ASTReader *Reader, ModuleFile *Mod,
1500- const LocalDeclID *Pos)
1492+ const serialization:: unaligned_decl_id_t *Pos)
15011493 : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
15021494
15031495 value_type operator *() const {
1504- return Reader->GetDecl (Reader->getGlobalDeclID (*Mod, *I));
1496+ return Reader->GetDecl (Reader->getGlobalDeclID (*Mod, (LocalDeclID) *I));
15051497 }
15061498
15071499 value_type operator ->() const { return **this ; }
@@ -1541,6 +1533,9 @@ class ASTReader
15411533 StringRef Arg2 = StringRef(), StringRef Arg3 = StringRef()) const ;
15421534 void Error (llvm::Error &&Err) const ;
15431535
1536+ // / Translate a \param GlobalDeclID to the index of DeclsLoaded array.
1537+ unsigned translateGlobalDeclIDToIndex (GlobalDeclID ID) const ;
1538+
15441539public:
15451540 // / Load the AST file and validate its contents against the given
15461541 // / Preprocessor.
@@ -1912,7 +1907,8 @@ class ASTReader
19121907
19131908 // / Retrieve the module file that owns the given declaration, or NULL
19141909 // / if the declaration is not from a module file.
1915- ModuleFile *getOwningModuleFile (const Decl *D);
1910+ ModuleFile *getOwningModuleFile (const Decl *D) const ;
1911+ ModuleFile *getOwningModuleFile (GlobalDeclID ID) const ;
19161912
19171913 // / Returns the source location for the decl \p ID.
19181914 SourceLocation getSourceLocationForDeclID (GlobalDeclID ID);
0 commit comments