[PATCH] D141535: [llvm] Refactor leftover ThreadLocal usage in MinGW code

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 11:51:57 PST 2023


zero9178 created this revision.
zero9178 added reviewers: resistor, mstorsjo.
Herald added a subscriber: hiraditya.
Herald added a project: All.
zero9178 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.

I am sadly currently not on my Windows machine, so could not test this patch yet, just noticed the failure on an LLVM update in my projects CI. I'd appreciate it if someone could test compilation with MinGW, otherwise I'd do so on Friday.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141535

Files:
  llvm/lib/Support/CrashRecoveryContext.cpp


Index: llvm/lib/Support/CrashRecoveryContext.cpp
===================================================================
--- llvm/lib/Support/CrashRecoveryContext.cpp
+++ llvm/lib/Support/CrashRecoveryContext.cpp
@@ -307,7 +307,7 @@
 // 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 @@
   // 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;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141535.488318.patch
Type: text/x-patch
Size: 1467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230111/2bfc9898/attachment.bin>


More information about the llvm-commits mailing list