[PATCH] D36821: [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*

Nikolai Kosjar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 00:08:55 PDT 2017


nik created this revision.

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()


https://reviews.llvm.org/D36821

Files:
  tools/libclang/CIndex.cpp


Index: tools/libclang/CIndex.cpp
===================================================================
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3504,6 +3504,12 @@
         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)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36821.111472.patch
Type: text/x-patch
Size: 535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170817/fd411c13/attachment.bin>


More information about the cfe-commits mailing list