diff --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp --- a/llvm/lib/Support/Signposts.cpp +++ b/llvm/lib/Support/Signposts.cpp @@ -13,6 +13,7 @@ #include "llvm/Config/config.h" #if LLVM_SUPPORT_XCODE_SIGNPOSTS #include "llvm/ADT/DenseMap.h" +#include "llvm/Support/Mutex.h" #include #endif // if LLVM_SUPPORT_XCODE_SIGNPOSTS @@ -38,9 +39,11 @@ LogPtrTy SignpostLog; DenseMap Signposts; + sys::SmartMutex Mutex; LogTy &getLogger() const { return *SignpostLog; } os_signpost_id_t getSignpostForObject(const void *O) { + sys::SmartScopedLock Lock(Mutex); const auto &I = Signposts.find(O); if (I != Signposts.end()) return I->second;