diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp index 67b07162b9a1..1985409f35c3 100644 --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -166,6 +166,7 @@ void llvm::PrintStatistics(raw_ostream &OS) { } void llvm::PrintStatisticsJSON(raw_ostream &OS) { + sys::SmartScopedLock Reader(*StatLock); StatisticInfo &Stats = *StatInfo; Stats.sort(); @@ -192,6 +193,7 @@ void llvm::PrintStatisticsJSON(raw_ostream &OS) { void llvm::PrintStatistics() { #if LLVM_ENABLE_STATS + sys::SmartScopedLock Reader(*StatLock); StatisticInfo &Stats = *StatInfo; // Statistics not enabled?