forked from OSchip/llvm-project
Introduce debugging/testing hook clang_enableStackTraces() into
CIndex, so that c-index-test to use it to call lvm::sys::PrintStackTraceOnErrorSignal(). llvm-svn: 96607
This commit is contained in:
parent
707cf72cb8
commit
81d53769b5
|
@ -507,7 +507,7 @@ CINDEX_LINKAGE void clang_displayDiagnostic(CXDiagnostic Diagnostic,
|
|||
* \returns A set of display options suitable for use with \c
|
||||
* clang_displayDiagnostic().
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions();
|
||||
CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
|
||||
|
||||
/**
|
||||
* \brief Print a diagnostic to the given file.
|
||||
|
@ -1322,7 +1322,7 @@ CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
|
|||
unsigned *startColumn,
|
||||
unsigned *endLine,
|
||||
unsigned *endColumn);
|
||||
|
||||
CINDEX_LINKAGE void clang_enableStackTraces(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/System/Program.h"
|
||||
#include "llvm/System/Signals.h"
|
||||
|
||||
// Needed to define L_TMPNAM on some systems.
|
||||
#include <cstdio>
|
||||
|
@ -1935,6 +1936,10 @@ void clang_getDefinitionSpellingAndExtent(CXCursor C,
|
|||
*endColumn = SM.getSpellingColumnNumber(Body->getRBracLoc());
|
||||
}
|
||||
|
||||
void clang_enableStackTraces(void) {
|
||||
llvm::sys::PrintStackTraceOnErrorSignal();
|
||||
}
|
||||
|
||||
} // end: extern "C"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -13,6 +13,7 @@ _clang_disposeIndex
|
|||
_clang_disposeString
|
||||
_clang_disposeTokens
|
||||
_clang_disposeTranslationUnit
|
||||
_clang_enableStackTraces
|
||||
_clang_equalCursors
|
||||
_clang_equalLocations
|
||||
_clang_getClangVersion
|
||||
|
|
|
@ -1009,6 +1009,7 @@ static void print_usage(void) {
|
|||
}
|
||||
|
||||
int main(int argc, const char **argv) {
|
||||
clang_enableStackTraces();
|
||||
if (argc > 2 && strstr(argv[1], "-code-completion-at=") == argv[1])
|
||||
return perform_code_completion(argc, argv);
|
||||
if (argc > 2 && strstr(argv[1], "-cursor-at=") == argv[1])
|
||||
|
|
Loading…
Reference in New Issue