Skip to content

Commit 2fbb148

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. DevCom ticket: https://developercommunity.microsoft.com/t/Classes-marked-with-__declspecdllexport/11003192
1 parent 5cde345 commit 2fbb148

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/include/llvm/Support/ThreadPool.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ 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+
// to work around a compiler bug where classes marked as
230+
// `__declspec(dllexport)` cause the compiler to attempt to generate a copy
231+
// assignment operator.
232+
SingleThreadExecutor(const SingleThreadExecutor &) = delete;
233+
SingleThreadExecutor &operator=(const SingleThreadExecutor &) = delete;
234+
228235
/// Blocking wait for all the tasks to execute first
229236
void wait() override;
230237

0 commit comments

Comments
 (0)