diff options
Diffstat (limited to 'dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch')
-rw-r--r-- | dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch new file mode 100644 index 00000000..103dad5e --- /dev/null +++ b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From c86c43b70e029b102543e8a85d269cbeb5c00279 Mon Sep 17 00:00:00 2001 | ||
2 | From: juanrod2 <> | ||
3 | Date: Tue, 22 Dec 2020 08:33:08 +0800 | ||
4 | Subject: [PATCH] Memory leak fix for Managed Static Mutex | ||
5 | |||
6 | Upstream-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 | |||
8 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
9 | |||
10 | Cleaning a mutex inside ManagedStatic llvm class. | ||
11 | --- | ||
12 | llvm/lib/Support/ManagedStatic.cpp | 6 +++++- | ||
13 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp | ||
16 | index 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 | -- | ||
34 | 2.29.2 | ||
35 | |||