r311990 - [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*

Erik Verbruggen via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 02:08:02 PDT 2017


Author: erikjv
Date: Tue Aug 29 02:08:02 2017
New Revision: 311990

URL: http://llvm.org/viewvc/llvm-project?rev=311990&view=rev
Log:
[libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*

Looks like this one was forgotten for clang_parseTranslationUnit*, as
LIBCLANG_NOTHREADS is checked for/in:

clang_saveTranslationUnit()
clang_reparseTranslationUnit()
clang_codeCompleteAt()
clang_indexTranslationUnit()
clang_indexSourceFile()

Patch by Nikolai Kosjar!

Differential Revision: https://reviews.llvm.org/D36821


Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=311990&r1=311989&r2=311990&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Tue Aug 29 02:08:02 2017
@@ -3504,6 +3504,12 @@ enum CXErrorCode clang_parseTranslationU
         CIdx, source_filename, command_line_args, num_command_line_args,
         llvm::makeArrayRef(unsaved_files, num_unsaved_files), options, out_TU);
   };
+
+  if (getenv("LIBCLANG_NOTHREADS")) {
+    ParseTranslationUnitImpl();
+    return result;
+  }
+
   llvm::CrashRecoveryContext CRC;
 
   if (!RunSafely(CRC, ParseTranslationUnitImpl)) {




More information about the cfe-commits mailing list