]> granicus.if.org Git - clang/commitdiff
[libclang] Check for LIBCLANG_DISABLE_CRASH_RECOVERY before enabling crash recovery.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 27 Nov 2013 08:58:09 +0000 (08:58 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 27 Nov 2013 08:58:09 +0000 (08:58 +0000)
Suggested by Alp Toker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195829 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index be29939b62d23b8c8ec6a734a53a497d32756a4f..255b74b472e6e7dcbc014467dbe36cb5752880f7 100644 (file)
@@ -2544,7 +2544,8 @@ CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
                           int displayDiagnostics) {
   // We use crash recovery to make some of our APIs more reliable, implicitly
   // enable it.
-  llvm::CrashRecoveryContext::Enable();
+  if (!getenv("LIBCLANG_DISABLE_CRASH_RECOVERY"))
+    llvm::CrashRecoveryContext::Enable();
 
   // Enable support for multithreading in LLVM.
   {
@@ -6515,11 +6516,6 @@ bool RunSafely(llvm::CrashRecoveryContext &CRC,
                unsigned Size) {
   if (!Size)
     Size = GetSafetyThreadStackSize();
-  if (getenv("LIBCLANG_DISABLE_CRASH_RECOVERY")) {
-    // Don't use crash recovery.
-    llvm::llvm_execute_on_thread(Fn, UserData, Size);
-    return true;
-  }
   if (Size)
     return CRC.RunSafelyOnThread(Fn, UserData, Size);
   return CRC.RunSafely(Fn, UserData);