forked from OSchip/llvm-project
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
This commit is contained in:
parent
fbeeb130d8
commit
c91f2fff98
|
@ -29,6 +29,7 @@
|
||||||
#include "clang/Lex/Lexer.h"
|
#include "clang/Lex/Lexer.h"
|
||||||
#include "clang/Lex/PreprocessingRecord.h"
|
#include "clang/Lex/PreprocessingRecord.h"
|
||||||
#include "clang/Lex/Preprocessor.h"
|
#include "clang/Lex/Preprocessor.h"
|
||||||
|
#include "llvm/Support/CrashRecoveryContext.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/Timer.h"
|
#include "llvm/Support/Timer.h"
|
||||||
#include "llvm/System/Program.h"
|
#include "llvm/System/Program.h"
|
||||||
|
@ -1153,6 +1154,10 @@ bool CursorVisitor::VisitAttributes(Decl *D) {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
|
CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
|
||||||
int displayDiagnostics) {
|
int displayDiagnostics) {
|
||||||
|
// We use crash recovery to make some of our APIs more reliable, implicitly
|
||||||
|
// enable it.
|
||||||
|
llvm::CrashRecoveryContext::Enable();
|
||||||
|
|
||||||
CIndexer *CIdxr = new CIndexer();
|
CIndexer *CIdxr = new CIndexer();
|
||||||
if (excludeDeclarationsFromPCH)
|
if (excludeDeclarationsFromPCH)
|
||||||
CIdxr->setOnlyLocalDecls();
|
CIdxr->setOnlyLocalDecls();
|
||||||
|
|
Loading…
Reference in New Issue