diff options
| author | Zachary Turner <zturner@google.com> | 2014-06-10 23:02:10 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2014-06-10 23:02:10 +0000 |
| commit | 475a76d93ab1d5fc0394042ff699b54676a90735 (patch) | |
| tree | f5a0d5681089595661cfb37e99711531b0146a3e | |
| parent | f6054ca18c86eaa4c204672404a4b9d24cb5233c (diff) | |
| download | bcm5719-llvm-475a76d93ab1d5fc0394042ff699b54676a90735.tar.gz bcm5719-llvm-475a76d93ab1d5fc0394042ff699b54676a90735.zip | |
Clang changes to support LLVM removal of runtime multithreading
support (llvm revision r210600).
Reviewers: rnk
Differential Revision: http://reviews.llvm.org/D4077
llvm-svn: 210601
| -rw-r--r-- | clang/tools/libclang/CIndex.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 4d296d46b73..7320bbd0851 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2556,8 +2556,8 @@ buildPieces(unsigned NameFlags, bool IsMemberRefExpr, // Misc. API hooks. //===----------------------------------------------------------------------===// -static llvm::sys::Mutex EnableMultithreadingMutex; -static bool EnabledMultithreading; +static llvm::sys::Mutex LoggingMutex; +static std::once_flag InstalledErrorHandlerFlag; static void fatal_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag) { @@ -2575,15 +2575,8 @@ CXIndex clang_createIndex(int excludeDeclarationsFromPCH, if (!getenv("LIBCLANG_DISABLE_CRASH_RECOVERY")) llvm::CrashRecoveryContext::Enable(); - // 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; - } - } + std::call_once(InstalledErrorHandlerFlag, + []() {llvm::install_fatal_error_handler(fatal_error_handler, nullptr);}); CIndexer *CIdxr = new CIndexer(); if (excludeDeclarationsFromPCH) @@ -6959,7 +6952,7 @@ Logger &cxindex::Logger::operator<<(const llvm::format_object_base &Fmt) { cxindex::Logger::~Logger() { LogOS.flush(); - llvm::sys::ScopedLock L(EnableMultithreadingMutex); + llvm::sys::ScopedLock L(LoggingMutex); static llvm::TimeRecord sBeginTR = llvm::TimeRecord::getCurrentTime(); |

