[llvm] 8fd8a97 - [llvm] Refactor leftover ThreadLocal usage in MinGW code

Markus Böck via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 12:47:37 PST 2023


Author: Markus Böck
Date: 2023-01-11T21:47:25+01:00
New Revision: 8fd8a97c9444e2106efa98870b21a3444e07a86c

URL: https://github.com/llvm/llvm-project/commit/8fd8a97c9444e2106efa98870b21a3444e07a86c
DIFF: https://github.com/llvm/llvm-project/commit/8fd8a97c9444e2106efa98870b21a3444e07a86c.diff

LOG: [llvm] Refactor leftover ThreadLocal usage in MinGW code

This code was accidently left over after https://reviews.llvm.org/D141349 and now leads to compilation failure due to missing declaration (since the class has been removed)

Just migrate it by making use of `LLVM_THREAD_LOCAL` instead.

Differential Revision: https://reviews.llvm.org/D141535

Added: 
    

Modified: 
    llvm/lib/Support/CrashRecoveryContext.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index fe0df90e9f2ea..e96a9b59d8347 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -307,7 +307,7 @@ static LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
 // CrashRecoveryContext at all.  So we make use of a thread-local
 // exception table.  The handles contained in here will either be
 // non-NULL, valid VEH handles, or NULL.
-static sys::ThreadLocal<const void> sCurrentExceptionHandle;
+static LLVM_THREAD_LOCAL const void* sCurrentExceptionHandle;
 
 static void installExceptionOrSignalHandlers() {
   // We can set up vectored exception handling now.  We will install our
@@ -315,17 +315,17 @@ static void installExceptionOrSignalHandlers() {
   // it will remain at the front (another call could install itself before
   // our handler).  This 1) isn't likely, and 2) shouldn't cause problems.
   PVOID handle = ::AddVectoredExceptionHandler(1, ExceptionHandler);
-  sCurrentExceptionHandle.set(handle);
+  sCurrentExceptionHandle = handle;
 }
 
 static void uninstallExceptionOrSignalHandlers() {
-  PVOID currentHandle = const_cast<PVOID>(sCurrentExceptionHandle.get());
+  PVOID currentHandle = const_cast<PVOID>(sCurrentExceptionHandle);
   if (currentHandle) {
     // Now we can remove the vectored exception handler from the chain
     ::RemoveVectoredExceptionHandler(currentHandle);
 
     // Reset the handle in our thread-local set.
-    sCurrentExceptionHandle.set(NULL);
+    sCurrentExceptionHandle = NULL;
   }
 }
 


        


More information about the llvm-commits mailing list