From be837badf3509fd1b93ff9c7259b5bae2f663803 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 29 Aug 2017 09:08:02 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311990 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/CIndex.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index ca21b6c6f6..ed4f263945 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -3504,6 +3504,12 @@ enum CXErrorCode clang_parseTranslationUnit2FullArgv( 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)) { -- 2.40.0