class ASTDeclReader : public DeclVisitor<ASTDeclReader, void> {
ASTReader &Reader;
ModuleFile &F;
+ uint64_t Offset;
const DeclID ThisDeclID;
const unsigned RawLocation;
typedef ASTReader::RecordData RecordData;
FindExistingResult findExisting(NamedDecl *D);
public:
- ASTDeclReader(ASTReader &Reader, ModuleFile &F, DeclID thisDeclID,
- unsigned RawLocation, const RecordData &Record, unsigned &Idx)
- : Reader(Reader), F(F), ThisDeclID(thisDeclID),
+ ASTDeclReader(ASTReader &Reader, ASTReader::RecordLocation Loc,
+ DeclID thisDeclID, unsigned RawLocation,
+ const RecordData &Record, unsigned &Idx)
+ : Reader(Reader), F(*Loc.F), Offset(Loc.Offset), ThisDeclID(thisDeclID),
RawLocation(RawLocation), Record(Record), Idx(Idx),
TypeIDForTypeDecl(0), NamedDeclForTagDecl(0),
TypedefNameForLinkage(nullptr), HasPendingBody(false) {}
MergeWith = ReadDecl(Record, Idx/*, MergeWith*/);
RedeclOffset = Record[Idx++];
+ // RedeclOffset is a delta relative to the start of this record.
+ if (RedeclOffset)
+ RedeclOffset = Offset - RedeclOffset;
} else {
// This declaration was not the first local declaration. Read the first
// local declaration now, to trigger the import of other redeclarations.
RecordData Record;
unsigned Code = DeclsCursor.ReadCode();
unsigned Idx = 0;
- ASTDeclReader Reader(*this, *Loc.F, ID, RawLocation, Record,Idx);
+ ASTDeclReader Reader(*this, Loc, ID, RawLocation, Record,Idx);
Decl *D = nullptr;
switch ((DeclCode)DeclsCursor.readRecord(Code, Record)) {
assert(RecCode == DECL_UPDATES && "Expected DECL_UPDATES record!");
unsigned Idx = 0;
- ASTDeclReader Reader(*this, *F, ID, 0, Record, Idx);
+ ASTDeclReader Reader(*this, RecordLocation(F, Offset), ID, 0, Record,
+ Idx);
Reader.UpdateDecl(D, *F, Record);
// We might have made this declaration interesting. If so, remember that