summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-0003-Memory-leak-fix-for-Managed-Static-Mutex.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-0003-Memory-leak-fix-for-Managed-Static-Mutex.patch')
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-0003-Memory-leak-fix-for-Managed-Static-Mutex.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-0003-Memory-leak-fix-for-Managed-Static-Mutex.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-0003-Memory-leak-fix-for-Managed-Static-Mutex.patch
new file mode 100644
index 00000000..3b035f47
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-0003-Memory-leak-fix-for-Managed-Static-Mutex.patch
@@ -0,0 +1,35 @@
1From cfb18b75e8a353bc7486f337541476a36994b063 Mon Sep 17 00:00:00 2001
2From: juanrod2 <>
3Date: Tue, 22 Dec 2020 08:33:08 +0800
4Subject: [PATCH 3/7] Memory leak fix for Managed Static Mutex
5
6Upstream-Status: Backport [Taken from opencl-clang patches; https://github.com/intel/opencl-clang/blob/ocl-open-100/patches/llvm/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch]
7
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9
10Cleaning a mutex inside ManagedStatic llvm class.
11---
12 llvm/lib/Support/ManagedStatic.cpp | 6 +++++-
13 1 file changed, 5 insertions(+), 1 deletion(-)
14
15diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
16index 053493f72fb5..6571580ccecf 100644
17--- a/llvm/lib/Support/ManagedStatic.cpp
18+++ b/llvm/lib/Support/ManagedStatic.cpp
19@@ -76,8 +76,12 @@ void ManagedStaticBase::destroy() const {
20
21 /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
22 void llvm::llvm_shutdown() {
23- std::lock_guard<std::recursive_mutex> Lock(*getManagedStaticMutex());
24+ getManagedStaticMutex()->lock();
25
26 while (StaticList)
27 StaticList->destroy();
28+
29+ getManagedStaticMutex()->unlock();
30+ delete ManagedStaticMutex;
31+ ManagedStaticMutex = nullptr;
32 }
33--
342.17.1
35