@@ -501,12 +501,6 @@ class ASTReader
501
501
// / = I + 1 has already been loaded.
502
502
llvm::PagedVector<Decl *> DeclsLoaded;
503
503
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
-
510
504
using FileOffset = std::pair<ModuleFile *, uint64_t >;
511
505
using FileOffsetsTy = SmallVector<FileOffset, 2 >;
512
506
using DeclUpdateOffsetsMap = llvm::DenseMap<GlobalDeclID, FileOffsetsTy>;
@@ -589,10 +583,11 @@ class ASTReader
589
583
590
584
struct FileDeclsInfo {
591
585
ModuleFile *Mod = nullptr ;
592
- ArrayRef<LocalDeclID > Decls;
586
+ ArrayRef<serialization:: unalighed_decl_id_t > Decls;
593
587
594
588
FileDeclsInfo () = default ;
595
- FileDeclsInfo (ModuleFile *Mod, ArrayRef<LocalDeclID> Decls)
589
+ FileDeclsInfo (ModuleFile *Mod,
590
+ ArrayRef<serialization::unalighed_decl_id_t > Decls)
596
591
: Mod(Mod), Decls(Decls) {}
597
592
};
598
593
@@ -601,11 +596,7 @@ class ASTReader
601
596
602
597
// / An array of lexical contents of a declaration context, as a sequence of
603
598
// / Decl::Kind, DeclID pairs.
604
- using unalighed_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<unalighed_decl_id_t >;
599
+ using LexicalContents = ArrayRef<serialization::unalighed_decl_id_t >;
609
600
610
601
// / Map from a DeclContext to its lexical contents.
611
602
llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
@@ -1486,22 +1477,23 @@ class ASTReader
1486
1477
unsigned ClientLoadCapabilities);
1487
1478
1488
1479
public:
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::unalighed_decl_id_t *,
1483
+ std::random_access_iterator_tag, const Decl *, ptrdiff_t ,
1484
+ const Decl *, const Decl *> {
1493
1485
ASTReader *Reader = nullptr ;
1494
1486
ModuleFile *Mod = nullptr ;
1495
1487
1496
1488
public:
1497
1489
ModuleDeclIterator () : iterator_adaptor_base(nullptr ) {}
1498
1490
1499
1491
ModuleDeclIterator (ASTReader *Reader, ModuleFile *Mod,
1500
- const LocalDeclID *Pos)
1492
+ const serialization:: unalighed_decl_id_t *Pos)
1501
1493
: iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1502
1494
1503
1495
value_type operator *() const {
1504
- return Reader->GetDecl (Reader->getGlobalDeclID (*Mod, *I));
1496
+ return Reader->GetDecl (Reader->getGlobalDeclID (*Mod, (LocalDeclID) *I));
1505
1497
}
1506
1498
1507
1499
value_type operator ->() const { return **this ; }
@@ -1541,6 +1533,9 @@ class ASTReader
1541
1533
StringRef Arg2 = StringRef(), StringRef Arg3 = StringRef()) const ;
1542
1534
void Error (llvm::Error &&Err) const ;
1543
1535
1536
+ // / Translate a \param GlobalDeclID to the index of DeclsLoaded array.
1537
+ unsigned translateGlobalDeclIDToIndex (GlobalDeclID ID) const ;
1538
+
1544
1539
public:
1545
1540
// / Load the AST file and validate its contents against the given
1546
1541
// / Preprocessor.
@@ -1912,7 +1907,8 @@ class ASTReader
1912
1907
1913
1908
// / Retrieve the module file that owns the given declaration, or NULL
1914
1909
// / 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 ;
1916
1912
1917
1913
// / Returns the source location for the decl \p ID.
1918
1914
SourceLocation getSourceLocationForDeclID (GlobalDeclID ID);
0 commit comments