I’m using libclang, and when using clang_reparseTranslationUnit method, I (nearly?) always get a crash:
Assertion failed: ((LatestDecl->getLocation().isInvalid() || NewLatest->getLocation().isInvalid() || !Reader.SourceMgr.isBeforeInTranslationUnit( NewLatest->getLocation(), LatestDecl->getLocation())) && “The new latest is supposed to come after the previous latest”), function VisitRedeclarableTemplateDecl, file /data/clang-llvm/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp, line 1094.
libclang: crash detected during reparsing
When I turn off CXTranslationUnit_CXXPrecompiledPreamble, things work fine (although quite a bit slower).
Does anybody have an idea how I can debug this, or in which direction I should look?
That sounds like a serious bug in the AST reader or writer. Debugging these can be fairly tricky; in this case, watching how that particular declaration ends up getting deserialized. If you could file a bug with reduced source code detailing the problem (which can be tricky, when dealing with preambles), we'd greatly appreciate it.
Attached is a patch that fixes this problem. It was made against trunk rev. 136769. Should I close bug#10511 myself when the patch is accepted, or how does that work?
0001-Make-the-type-of-the-IntegerLiteral-for-bitfield-pad.patch (1.61 KB)
Attached is a patch that fixes this problem. It was made against trunk rev. 136769.
Great, thanks! Committed as r136786.
Should I close bug#10511 myself when the patch is accepted, or how does that work?
Please go ahead and close 10511, and note the revision number of the commit.