diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp --- a/llvm/lib/Support/ManagedStatic.cpp +++ b/llvm/lib/Support/ManagedStatic.cpp @@ -76,8 +76,13 @@ /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. void llvm::llvm_shutdown() { - std::lock_guard Lock(*getManagedStaticMutex()); + getManagedStaticMutex()->lock(); while (StaticList) StaticList->destroy(); + + getManagedStaticMutex()->unlock(); + + delete ManagedStaticMutex; + ManagedStaticMutex = nullptr; }