summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-08-18 18:43:14 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-08-18 18:43:14 +0000
commitc91f2fff9892a0da71fd05d1b6596a832cdffee1 (patch)
tree4c6ece5647220573635fa7c9bd35d7563e696646 /clang/tools
parentfbeeb130d8cef9e5d5a269733ac8d487dd1d65fa (diff)
downloadbcm5719-llvm-c91f2fff9892a0da71fd05d1b6596a832cdffee1.tar.gz
bcm5719-llvm-c91f2fff9892a0da71fd05d1b6596a832cdffee1.zip
libclang: Implicitly enable crash recovery when using the libclang APIs. We may need to add an explicit API call, but hopefully we can make the crash recovery seamless enough that it doesn't make sense to turn it off.
llvm-svn: 111386
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/libclang/CIndex.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 5e9b1ca089c..e0720e788a9 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -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();
OpenPOWER on IntegriCloud