diff options
| author | Fabrice de Gans <Steelskin@users.noreply.github.com> | 2025-11-21 12:33:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 09:33:34 -0800 |
| commit | f8a803952e9e8daa2c2714d8346b696799e9c833 (patch) | |
| tree | f9c29cdd08d9514cfe199801163cde377ecd688a | |
| parent | 55d8b63195882d07ec4dc390d2c558bebc4e295d (diff) | |
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
| -rw-r--r-- | llvm/include/llvm/Support/ThreadPool.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h index 1be7779f2c72..4f91455f204f 100644 --- a/llvm/include/llvm/Support/ThreadPool.h +++ b/llvm/include/llvm/Support/ThreadPool.h @@ -225,6 +225,12 @@ public: /// 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; |
