diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-31 07:20:15 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-31 07:20:15 +0000 |
commit | ef23b6001e8d9715246ca23bd8c3a6887d7844cb (patch) | |
tree | 1d804502a321c84095efa2ec80bb1c772a75710a /lib/Serialization | |
parent | 9d128d04578c62675eeb0cce83066052f9c19c9a (diff) |
[PCH] Now that we store the location of a decl outside its record
make sure that we keep track of locations of replaced decls as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 6 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 6 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 7 | ||||
-rw-r--r-- | lib/Serialization/ASTWriterDecl.cpp | 3 |
4 files changed, 13 insertions, 9 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 7ae0c42069..4554f05256 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -2217,13 +2217,13 @@ ASTReader::ReadASTBlock(Module &F) { } case DECL_REPLACEMENTS: { - if (Record.size() % 2 != 0) { + if (Record.size() % 3 != 0) { Error("invalid DECL_REPLACEMENTS block in AST file"); return Failure; } - for (unsigned I = 0, N = Record.size(); I != N; I += 2) + for (unsigned I = 0, N = Record.size(); I != N; I += 3) ReplacedDecls[getGlobalDeclID(F, Record[I])] - = std::make_pair(&F, Record[I+1]); + = ReplacedDeclInfo(&F, Record[I+1], Record[I+2]); break; } diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 7b37bbfa1b..d414c07290 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -1449,8 +1449,10 @@ ASTReader::RecordLocation ASTReader::DeclCursorForID(DeclID ID, unsigned &RawLocation) { // See if there's an override. DeclReplacementMap::iterator It = ReplacedDecls.find(ID); - if (It != ReplacedDecls.end()) - return RecordLocation(It->second.first, It->second.second); + if (It != ReplacedDecls.end()) { + RawLocation = It->second.RawLoc; + return RecordLocation(It->second.Mod, It->second.Offset); + } GlobalDeclMapType::iterator I = GlobalDeclMap.find(ID); assert(I != GlobalDeclMap.end() && "Corrupted global declaration map"); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 1b44baa9ce..9716447dfa 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -3234,10 +3234,11 @@ void ASTWriter::WriteDeclReplacementsBlock() { return; RecordData Record; - for (SmallVector<std::pair<DeclID, uint64_t>, 16>::iterator + for (SmallVector<ReplacedDeclInfo, 16>::iterator I = ReplacedDecls.begin(), E = ReplacedDecls.end(); I != E; ++I) { - Record.push_back(I->first); - Record.push_back(I->second); + Record.push_back(I->ID); + Record.push_back(I->Offset); + Record.push_back(I->Loc); } Stream.EmitRecord(DECL_REPLACEMENTS, Record); } diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 3e3e28dfbb..c35d4b0d22 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -1647,7 +1647,8 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { if (ID < FirstDeclID) { // We're replacing a decl in a previous file. - ReplacedDecls.push_back(std::make_pair(ID, Stream.GetCurrentBitNo())); + ReplacedDecls.push_back(ReplacedDeclInfo(ID, Stream.GetCurrentBitNo(), + D->getLocation())); } else { unsigned Index = ID - FirstDeclID; |