Skip to content

Commit 84a01ba

Browse files
committed
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.
1 parent 5cde345 commit 84a01ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/include/llvm/Support/ThreadPool.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ class LLVM_ABI SingleThreadExecutor : public ThreadPoolInterface {
225225
/// Blocking destructor: the pool will first execute the pending tasks.
226226
~SingleThreadExecutor() override;
227227

228+
// Excplicitly disable copy. This is necessary for the MSVC LLVM_DYLIB build
229+
// because MSVC tries to generate copy constructor and assignment operator
230+
// for classes marked with `__declspec(dllexport)`.
231+
SingleThreadExecutor(const SingleThreadExecutor &) = delete;
232+
SingleThreadExecutor &operator=(const SingleThreadExecutor &) = delete;
233+
228234
/// Blocking wait for all the tasks to execute first
229235
void wait() override;
230236

0 commit comments

Comments
 (0)