[cfe-commits] r127920 - in /cfe/trunk: include/clang-c/Index.h tools/libclang/CIndex.cpp tools/libclang/libclang.darwin.exports tools/libclang/libclang.exports

Ted Kremenek kremenek at apple.com
Fri Mar 18 16:05:39 PDT 2011


Author: kremenek
Date: Fri Mar 18 18:05:39 2011
New Revision: 127920

URL: http://llvm.org/viewvc/llvm-project?rev=127920&view=rev
Log:
Add libclang hook 'clang_toggleCrashRecovery()', which provides a mechanism for a client to enable/disable CrashRecovery within libclang function calls.

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

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=127920&r1=127919&r2=127920&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Mar 18 18:05:39 2011
@@ -2871,6 +2871,15 @@
  */
 CINDEX_LINKAGE CXString clang_getClangVersion();
 
+  
+/**
+ * \brief Enable/disable crash recovery.
+ *
+ * \param Flag to indicate if crash recovery is enabled.  A non-zero value
+ *        enables crash recovery, while 0 disables it.
+ */
+CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
+  
  /**
   * \brief Visitor invoked for each file in a translation unit
   *        (used with clang_getInclusions()).

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=127920&r1=127919&r2=127920&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Mar 18 18:05:39 2011
@@ -2309,6 +2309,13 @@
     delete static_cast<CIndexer *>(CIdx);
 }
 
+void clang_toggleCrashRecovery(unsigned isEnabled) {
+  if (isEnabled)
+    llvm::CrashRecoveryContext::Enable();
+  else
+    llvm::CrashRecoveryContext::Disable();
+}
+  
 CXTranslationUnit clang_createTranslationUnit(CXIndex CIdx,
                                               const char *ast_filename) {
   if (!CIdx)

Modified: cfe/trunk/tools/libclang/libclang.darwin.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.darwin.exports?rev=127920&r1=127919&r2=127920&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.darwin.exports (original)
+++ cfe/trunk/tools/libclang/libclang.darwin.exports Fri Mar 18 18:05:39 2011
@@ -108,8 +108,8 @@
 _clang_getTypeDeclaration
 _clang_getTypeKindSpelling
 _clang_hashCursor
-_clang_isCursorDefinition
 _clang_isConstQualifiedType
+_clang_isCursorDefinition
 _clang_isDeclaration
 _clang_isExpression
 _clang_isInvalid
@@ -126,6 +126,7 @@
 _clang_reparseTranslationUnit
 _clang_saveTranslationUnit
 _clang_sortCodeCompletionResults
+_clang_toggleCrashRecovery
 _clang_tokenize
 _clang_visitChildren
 _clang_visitChildrenWithBlock

Modified: cfe/trunk/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=127920&r1=127919&r2=127920&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.exports (original)
+++ cfe/trunk/tools/libclang/libclang.exports Fri Mar 18 18:05:39 2011
@@ -126,6 +126,7 @@
 clang_reparseTranslationUnit
 clang_saveTranslationUnit
 clang_sortCodeCompletionResults
+clang_toggleCrashRecovery
 clang_tokenize
 clang_visitChildren
 clang_visitChildrenWithBlock





More information about the cfe-commits mailing list