<div dir="ltr">I have some more information for my problem, the crash seemingly only happens when the program is calling clang_reparseTranslationUnit and the source file is being changed from a different process at the exact same time. Does reparsing require passing the source file as a CXUnsavedFile? If so, does that only go for the main source file or does it apply for all included files as well?<div>
<br></div><div style>These are the first few frames of what gdb tells me when the program crashes,</div><div style><br></div><div style><div>#0  0x00007ffff5aef423 in ComputeLineNumbers(clang::DiagnosticsEngine&, clang::SrcMgr::ContentCache*, llvm::BumpPtrAllocator&, clang::SourceManager const&, bool&) () from /usr/local/clang-3.3/lib/libclang.so</div>
<div>#1  0x00007ffff5aef15d in clang::SourceManager::getLineNumber(clang::FileID, unsigned int, bool*) const () from /usr/local/clang-3.3/lib/libclang.so</div><div>#2  0x00007ffff5aeef64 in clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool) const () from /usr/local/clang-3.3/lib/libclang.so</div>
<div>#3  0x00007ffff5abffe8 in clang::Preprocessor::ExpandBuiltinMacro(clang::Token&) () from /usr/local/clang-3.3/lib/libclang.so</div><div>#4  0x00007ffff5abf659 in clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&, clang::MacroDirective*) () from /usr/local/clang-3.3/lib/libclang.so</div>
<div>#5  0x00007ffff5ad4cf3 in clang::Preprocessor::HandleIdentifier(clang::Token&) () from /usr/local/clang-3.3/lib/libclang.so</div><div><br></div><div style>Full stack trace can be found at</div><div style><br></div>
<div style><a href="https://gist.github.com/jhanssen/5479586">https://gist.github.com/jhanssen/5479586</a><br></div></div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Apr 28, 2013 at 3:20 AM, jhanssen <span dir="ltr"><<a href="mailto:jhanssen@gmail.com" target="_blank">jhanssen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I'm involved with a project that's using clang to index source files and I'm<br>
currently having strange crashes in calls to clang_reparseTranslationUnit,<br>
this seemingly happens both in Clang 3.2 and trunk as of r180688. The<br>
program is running multiple threads, if I never do a reparse but always do a<br>
full parse from source then I don't see any crashes. I've verified that no<br>
other threads are touching the same unit when this happens.<br>
<br>
It's not trivial to reproduce, and I've only ever seen it when multiple<br>
threads are calling into clang at the same time and the source code at the<br>
same time is not compiling.<br>
<br>
Are there any known problems with clang_reparseTranslationUnit and calling<br>
that from multiple threads at the same time?<br>
<br>
Thanks!<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Is-clang-reparseTranslationUnit-reentrant-tp4031793.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Is-clang-reparseTranslationUnit-reentrant-tp4031793.html</a><br>

Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>