]> granicus.if.org Git - clang/commitdiff
libclang: Implicitly enable crash recovery when using the libclang APIs. We may need...
authorDaniel Dunbar <daniel@zuster.org>
Wed, 18 Aug 2010 18:43:14 +0000 (18:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 18 Aug 2010 18:43:14 +0000 (18:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111386 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 5e9b1ca089c254cf602e082360de6cdc7d5efa21..e0720e788a96a18d0b4ad5074ca114007b4be953 100644 (file)
@@ -29,6 +29,7 @@
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/Preprocessor.h"
+#include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/System/Program.h"
@@ -1153,6 +1154,10 @@ bool CursorVisitor::VisitAttributes(Decl *D) {
 extern "C" {
 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();
+
   CIndexer *CIdxr = new CIndexer();
   if (excludeDeclarationsFromPCH)
     CIdxr->setOnlyLocalDecls();