Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls that will be replaced in the chained PCH.

llvm-svn: 117238
This commit is contained in:
Argyrios Kyrtzidis 2010-10-24 17:26:46 +00:00
parent 97bfda9b9b
commit 3ba70b89cf
2 changed files with 11 additions and 0 deletions

View File

@ -223,6 +223,10 @@ private:
/// to this set, so that we can write out lexical content updates for it.
llvm::SmallPtrSet<const NamespaceDecl *, 16> UpdatedNamespaces;
typedef llvm::SmallPtrSet<const Decl *, 16> DeclsToRewriteTy;
/// \brief Decls that will be replaced in the current dependent AST file.
DeclsToRewriteTy DeclsToRewrite;
/// \brief Decls that have been replaced in the current dependent AST file.
///
/// When a decl changes fundamentally after being deserialized (this shouldn't

View File

@ -2410,6 +2410,10 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
else
WriteDecl(Context, DOT.getDecl());
}
for (DeclsToRewriteTy::iterator
I = DeclsToRewrite.begin(), E = DeclsToRewrite.end(); I != E; ++I) {
WriteDecl(Context, const_cast<Decl*>(*I));
}
Stream.ExitBlock();
WritePreprocessor(PP);
@ -2720,6 +2724,9 @@ void ASTWriter::WriteDeclUpdatesBlocks() {
const Decl *D = I->first;
UpdateRecord &URec = I->second;
if (DeclsToRewrite.count(D))
continue; // The decl will be written completely,no need to store updates.
uint64_t Offset = Stream.GetCurrentBitNo();
Stream.EmitRecord(DECL_UPDATES, URec);