Revert "Clang changes to support LLVM removal of runtime multithreading"

This reverts r210601.

llvm-svn: 210604
This commit is contained in:
Zachary Turner 2014-06-10 23:17:11 +00:00
parent 6610b99cb5
commit 18532316f3
1 changed files with 12 additions and 5 deletions

View File

@ -2556,8 +2556,8 @@ buildPieces(unsigned NameFlags, bool IsMemberRefExpr,
// 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 excludeDeclarationsFromPCH,
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<<(const llvm::format_object_base &Fmt) {
cxindex::Logger::~Logger() {
LogOS.flush();
llvm::sys::ScopedLock L(LoggingMutex);
llvm::sys::ScopedLock L(EnableMultithreadingMutex);
static llvm::TimeRecord sBeginTR = llvm::TimeRecord::getCurrentTime();