Fix the re-serializing decls in a chained PCH mechanism.

llvm-svn: 117534
This commit is contained in:
Argyrios Kyrtzidis 2010-10-28 07:38:45 +00:00
parent 402dbbbd66
commit 4729972c0f
2 changed files with 10 additions and 5 deletions

View File

@ -448,6 +448,12 @@ public:
UpdatedNamespaces.insert(NS);
}
void RewriteDecl(const Decl *D) {
DeclsToRewrite.insert(D);
// Reset the flag, so that we don't add this decl multiple times.
const_cast<Decl *>(D)->setChangedSinceDeserialization(false);
}
/// \brief Note that the identifier II occurs at the given offset
/// within the identifier table.
void SetIdentifierOffset(const IdentifierInfo *II, uint32_t Offset);

View File

@ -2395,10 +2395,6 @@ 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);
@ -2604,6 +2600,9 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
Stream.EnterSubblock(DECLTYPES_BLOCK_ID, 3);
WriteDeclsBlockAbbrevs();
for (DeclsToRewriteTy::iterator
I = DeclsToRewrite.begin(), E = DeclsToRewrite.end(); I != E; ++I)
DeclTypesToEmit.push(const_cast<Decl*>(*I));
while (!DeclTypesToEmit.empty()) {
DeclOrType DOT = DeclTypesToEmit.front();
DeclTypesToEmit.pop();
@ -3287,7 +3286,7 @@ void ASTWriter::CompletedTagDefinition(const TagDecl *D) {
// A forward reference was mutated into a definition. Rewrite it.
// FIXME: This happens during template instantiation, should we
// have created a new definition decl instead ?
DeclsToRewrite.insert(RD);
RewriteDecl(RD);
}
for (CXXRecordDecl::redecl_iterator