On Wed, Sep 4, 2013 at 6:32 PM, Richard Smith <[email protected]> wrote:
> On Wed, Sep 4, 2013 at 6:07 PM, Eli Friedman <[email protected]>wrote: > >> With this commit, I'm hitting the following assertion: >> >> Assertion failed: (!WritingAST && "Already writing the AST!"), function >> DeclarationMarkedUsed, file >> /Volumes/storage/llvm/tools/clang/lib/Serialization/ASTWriter.cpp, line >> 5376. >> >> (Unfortunately, it's going to be a bit difficult to reduce.) >> >> Basically, what happens is that ASTWriter::WriteASTCore() calls >> ASTReader::updateOutOfDateIdentifier(), which eventually calls >> ASTDeclReader::UpdateDecl, which explodes because we're updating the AST in >> the middle of writing it. >> >> What do you think of moving the loop which call updateOutOfDateIdentifier >> out into ASTWriter::WriteAST, before we set WritingAST to true? >> > > No objection to that change, but I'm pretty sure there are other parts of > the AST writer that trigger deserialization of AST nodes. Another > possibility: > > + case UPD_DECL_MARKED_USED: { > + D->markUsed(Reader.getContext()); > + break; > > Do you need to use markUsed here, rather than setIsUsed? We already have > an appropriate update record for this declaration in whichever AST file > we're loading. > > > I'm not sure I really understand how this needs to work. I mean, the ASTWriter doesn't really care if it doesn't get notified: any update record has to come from a file which the file its writing depends on. On the other hand, other users of ASTMutationListener (are the any?) might care: if the decl got deserialized before the AST file with the update was included, they might miss an update caused by loading an AST file. -Eli
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
