From 44e9645567a558523d749fe65783e8cb2b499413 Mon Sep 17 00:00:00 2001 From: kstoimenov <87100199+kstoimenov@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:59:41 -0700 Subject: [PATCH] Fix the logic in DWARFContext thread safety selection (#11) The patch triggered some TSAN reports. Looks like the logic which decided if the thread safe or thread unsafe implementation should be used is inverted. The test is passing with this patch in place. --- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index a45ed0e56553d4..e338a2ebfc9c2c 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -734,7 +734,7 @@ DWARFContext::DWARFContext(std::unique_ptr DObj, : DIContext(CK_DWARF), RecoverableErrorHandler(RecoverableErrorHandler), WarningHandler(WarningHandler), DObj(std::move(DObj)) { - if (ThreadSafe) + if (!ThreadSafe) State.reset(new ThreadUnsafeDWARFContextState(*this, DWPName)); else State.reset(new ThreadSafeState(*this, DWPName));