[clang] Fix the logic in DWARFContext thread safety selection (#11) (PR #66786)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 19 10:52:56 PDT 2023
https://github.com/kstoimenov updated https://github.com/llvm/llvm-project/pull/66786
>From 44e9645567a558523d749fe65783e8cb2b499413 Mon Sep 17 00:00:00 2001
From: kstoimenov <87100199+kstoimenov at 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 a45ed0e56553d4e..e338a2ebfc9c2c7 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -734,7 +734,7 @@ DWARFContext::DWARFContext(std::unique_ptr<const DWARFObject> 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));
More information about the cfe-commits
mailing list