[cfe-commits] r96607 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp tools/CIndex/CIndex.exports tools/c-index-test/c-index-test.c

Douglas Gregor dgregor at apple.com
Thu Feb 18 12:22:26 PST 2010


Author: dgregor
Date: Thu Feb 18 14:22:25 2010
New Revision: 96607

URL: http://llvm.org/viewvc/llvm-project?rev=96607&view=rev
Log:
Introduce debugging/testing hook clang_enableStackTraces() into
CIndex, so that c-index-test to use it to call
lvm::sys::PrintStackTraceOnErrorSignal().

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/CIndex/CIndex.cpp
    cfe/trunk/tools/CIndex/CIndex.exports
    cfe/trunk/tools/c-index-test/c-index-test.c

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=96607&r1=96606&r2=96607&view=diff

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Thu Feb 18 14:22:25 2010
@@ -507,7 +507,7 @@
  * \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 @@
                                           unsigned *startColumn,
                                           unsigned *endLine,
                                           unsigned *endColumn);
-
+CINDEX_LINKAGE void clang_enableStackTraces(void);
 /**
  * @}
  */

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=96607&r1=96606&r2=96607&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Thu Feb 18 14:22:25 2010
@@ -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 @@
   *endColumn = SM.getSpellingColumnNumber(Body->getRBracLoc());
 }
 
+void clang_enableStackTraces(void) {
+  llvm::sys::PrintStackTraceOnErrorSignal();
+}
+
 } // end: extern "C"
 
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/tools/CIndex/CIndex.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.exports?rev=96607&r1=96606&r2=96607&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.exports (original)
+++ cfe/trunk/tools/CIndex/CIndex.exports Thu Feb 18 14:22:25 2010
@@ -13,6 +13,7 @@
 _clang_disposeString
 _clang_disposeTokens
 _clang_disposeTranslationUnit
+_clang_enableStackTraces
 _clang_equalCursors
 _clang_equalLocations
 _clang_getClangVersion

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=96607&r1=96606&r2=96607&view=diff

==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Thu Feb 18 14:22:25 2010
@@ -1009,6 +1009,7 @@
 }
 
 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])





More information about the cfe-commits mailing list