From 65d15fefe3392b1db2f679b3df029d43d8d26d2d Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 5 Nov 2020 16:41:31 -0800 Subject: [PATCH] [TargetList] Delete the destructor AFAICT, ~TargetList simply implements the default destructor, plus some locking. The history is murky, so I'm not sure why we do this locking. Perhaps, at some point, it was possible to delete the same TargetList instance from two different threads, setting up a race. If that were true, then the locking would protect against the race. Since TargetList is uniquely owned by Debugger (m_target_list), no such race is possible today. Testing: check-lldb Differential Revision: https://reviews.llvm.org/D90895 --- lldb/include/lldb/Target/TargetList.h | 2 -- lldb/source/Target/TargetList.cpp | 6 ------ 2 files changed, 8 deletions(-) diff --git a/lldb/include/lldb/Target/TargetList.h b/lldb/include/lldb/Target/TargetList.h index ff7fbd2..94b25f6 100644 --- a/lldb/include/lldb/Target/TargetList.h +++ b/lldb/include/lldb/Target/TargetList.h @@ -42,8 +42,6 @@ public: return GetStaticBroadcasterClass(); } - ~TargetList() override; - /// Create a new Target. /// /// Clients must use this function to create a Target. This allows diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index ce9661c..2be32c5 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -42,12 +42,6 @@ TargetList::TargetList(Debugger &debugger) CheckInWithManager(); } -// Destructor -TargetList::~TargetList() { - std::lock_guard guard(m_target_list_mutex); - m_target_list.clear(); -} - Status TargetList::CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, -- 2.7.4