From 28a5c6994a56f83236fbf48fbae86cc28c66452f Mon Sep 17 00:00:00 2001 From: Fabroce de Gans Date: Wed, 10 Dec 2025 12:43:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=92=20llvm:=20Disable=20copy=20for=20S?= =?UTF-8?q?ingleThreadExecutor=20(llvm#168782)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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 9272760fc140a..4bc4d90713493 100644 --- a/llvm/include/llvm/Support/ThreadPool.h +++ b/llvm/include/llvm/Support/ThreadPool.h @@ -224,6 +224,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;