[cfe-dev] llvm::CrashRecoveryContext (in libclang)

John Sully via cfe-dev cfe-dev at lists.llvm.org
Sun Sep 27 20:13:32 PDT 2015

I'm writing a client application that uses libclang and uses it to parse
documents on multiple threads.  I've been debugging a memory corruption bug
and traced it to the CrashRecoveryContext destructor deleting other
thread's Parser objects out from under it.

Looking at the CrashRecoveryContext code it appears no effort is made to
make this thread safe, specifically it heavily relies on static members
which is how pointers are making their way across threads.

There are two questions here:
1) Is libclang intended to be thread safe?  (I.e. would a patch be accepted
to fix this or is this behavior by design)

2) Generally "recovering" from unknown crashes is considered to be bad
practice, is there a recommended way to prevent use of the crash recovery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150927/0ee5f6b2/attachment.html>

More information about the cfe-dev mailing list