r210604 - Revert "Clang changes to support LLVM removal of runtime multithreading"
Zachary Turner
zturner at google.com
Tue Jun 10 16:17:11 PDT 2014
Author: zturner
Date: Tue Jun 10 18:17:11 2014
New Revision: 210604
URL: http://llvm.org/viewvc/llvm-project?rev=210604&view=rev
Log:
Revert "Clang changes to support LLVM removal of runtime multithreading"
This reverts r210601.
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=210604&r1=210603&r2=210604&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Tue Jun 10 18:17:11 2014
@@ -2556,8 +2556,8 @@ buildPieces(unsigned NameFlags, bool IsM
// Misc. API hooks.
//===----------------------------------------------------------------------===//
-static llvm::sys::Mutex LoggingMutex;
-static std::once_flag InstalledErrorHandlerFlag;
+static llvm::sys::Mutex EnableMultithreadingMutex;
+static bool EnabledMultithreading;
static void fatal_error_handler(void *user_data, const std::string& reason,
bool gen_crash_diag) {
@@ -2575,8 +2575,15 @@ CXIndex clang_createIndex(int excludeDec
if (!getenv("LIBCLANG_DISABLE_CRASH_RECOVERY"))
llvm::CrashRecoveryContext::Enable();
- std::call_once(InstalledErrorHandlerFlag,
- []() {llvm::install_fatal_error_handler(fatal_error_handler, nullptr);});
+ // Enable support for multithreading in LLVM.
+ {
+ llvm::sys::ScopedLock L(EnableMultithreadingMutex);
+ if (!EnabledMultithreading) {
+ llvm::install_fatal_error_handler(fatal_error_handler, nullptr);
+ llvm::llvm_start_multithreaded();
+ EnabledMultithreading = true;
+ }
+ }
CIndexer *CIdxr = new CIndexer();
if (excludeDeclarationsFromPCH)
@@ -6952,7 +6959,7 @@ Logger &cxindex::Logger::operator<<(cons
cxindex::Logger::~Logger() {
LogOS.flush();
- llvm::sys::ScopedLock L(LoggingMutex);
+ llvm::sys::ScopedLock L(EnableMultithreadingMutex);
static llvm::TimeRecord sBeginTR = llvm::TimeRecord::getCurrentTime();
More information about the cfe-commits
mailing list