[PATCH] D37554: [libclang] Allow crash recovery with LIBCLANG_NOTHREADS
Nikolai Kosjar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 23 02:51:35 PDT 2017
nik updated this revision to Diff 119823.
nik added a comment.
Rebased and took over better wording/description from Ilya.
https://reviews.llvm.org/D37554
Files:
tools/libclang/CIndex.cpp
tools/libclang/CIndexCodeCompletion.cpp
tools/libclang/Indexing.cpp
Index: tools/libclang/Indexing.cpp
===================================================================
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -880,11 +880,6 @@
TU_options);
};
- if (getenv("LIBCLANG_NOTHREADS")) {
- IndexSourceFileImpl();
- return result;
- }
-
llvm::CrashRecoveryContext CRC;
if (!RunSafely(CRC, IndexSourceFileImpl)) {
@@ -934,11 +929,6 @@
index_options, TU);
};
- if (getenv("LIBCLANG_NOTHREADS")) {
- IndexTranslationUnitImpl();
- return result;
- }
-
llvm::CrashRecoveryContext CRC;
if (!RunSafely(CRC, IndexTranslationUnitImpl)) {
Index: tools/libclang/CIndexCodeCompletion.cpp
===================================================================
--- tools/libclang/CIndexCodeCompletion.cpp
+++ tools/libclang/CIndexCodeCompletion.cpp
@@ -806,11 +806,6 @@
llvm::makeArrayRef(unsaved_files, num_unsaved_files), options);
};
- if (getenv("LIBCLANG_NOTHREADS")) {
- CodeCompleteAtImpl();
- return result;
- }
-
llvm::CrashRecoveryContext CRC;
if (!RunSafely(CRC, CodeCompleteAtImpl)) {
Index: tools/libclang/CIndex.cpp
===================================================================
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3508,11 +3508,6 @@
llvm::makeArrayRef(unsaved_files, num_unsaved_files), options, out_TU);
};
- if (getenv("LIBCLANG_NOTHREADS")) {
- ParseTranslationUnitImpl();
- return result;
- }
-
llvm::CrashRecoveryContext CRC;
if (!RunSafely(CRC, ParseTranslationUnitImpl)) {
@@ -3921,8 +3916,7 @@
result = clang_saveTranslationUnit_Impl(TU, FileName, options);
};
- if (!CXXUnit->getDiagnostics().hasUnrecoverableErrorOccurred() ||
- getenv("LIBCLANG_NOTHREADS")) {
+ if (!CXXUnit->getDiagnostics().hasUnrecoverableErrorOccurred()) {
SaveTranslationUnitImpl();
if (getenv("LIBCLANG_RESOURCE_USAGE"))
@@ -4045,11 +4039,6 @@
TU, llvm::makeArrayRef(unsaved_files, num_unsaved_files), options);
};
- if (getenv("LIBCLANG_NOTHREADS")) {
- ReparseTranslationUnitImpl();
- return result;
- }
-
llvm::CrashRecoveryContext CRC;
if (!RunSafely(CRC, ReparseTranslationUnitImpl)) {
@@ -8164,7 +8153,7 @@
unsigned Size) {
if (!Size)
Size = GetSafetyThreadStackSize();
- if (Size)
+ if (Size && !getenv("LIBCLANG_NOTHREADS"))
return CRC.RunSafelyOnThread(Fn, Size);
return CRC.RunSafely(Fn);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37554.119823.patch
Type: text/x-patch
Size: 2483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171023/6de4262d/attachment-0001.bin>
More information about the cfe-commits
mailing list