From 84a01baef174ec0d67ef33656bb41dbc0c5562c0 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Wed, 19 Nov 2025 21:48:34 +0000 Subject: [PATCH] llvm: Disable copy for SingleThreadExecutor 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. --- llvm/include/llvm/Support/ThreadPool.h | 6 ++++++ 1 file changed, 6 insertions(+) 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;