[llvm] f8a8039 - llvm: Disable copy for SingleThreadExecutor (#168782)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 09:33:38 PST 2025


Author: Fabrice de Gans
Date: 2025-11-21T09:33:34-08:00
New Revision: f8a803952e9e8daa2c2714d8346b696799e9c833

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

LOG: llvm: Disable copy for SingleThreadExecutor (#168782)

This is a workaround for the MSVC compiler, which attempts to generate a
copy assignment operator implementation for classes marked as
`__declspec(dllexport)`. Explicitly marking the copy assignment operator
as deleted works around the problem.

DevCom ticket:
https://developercommunity.microsoft.com/t/Classes-marked-with-__declspecdllexport/11003192

Added: 
    

Modified: 
    llvm/include/llvm/Support/ThreadPool.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 1be7779f2c72c..4f91455f204fd 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -225,6 +225,12 @@ class LLVM_ABI SingleThreadExecutor : public ThreadPoolInterface {
   /// Blocking destructor: the pool will first execute the pending tasks.
   ~SingleThreadExecutor() override;
 
+  // Excplicitly disable copy. This is necessary for the MSVC LLVM_DYLIB build
+  // because MSVC tries to generate copy constructor and assignment operator
+  // for classes marked with `__declspec(dllexport)`.
+  SingleThreadExecutor(const SingleThreadExecutor &) = delete;
+  SingleThreadExecutor &operator=(const SingleThreadExecutor &) = delete;
+
   /// Blocking wait for all the tasks to execute first
   void wait() override;
 


        


More information about the llvm-commits mailing list