[Lldb-commits] [lldb] 65d15fe - [TargetList] Delete the destructor

Vedant Kumar via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 5 16:56:52 PST 2020


Author: Vedant Kumar
Date: 2020-11-05T16:56:37-08:00
New Revision: 65d15fefe3392b1db2f679b3df029d43d8d26d2d

URL: https://github.com/llvm/llvm-project/commit/65d15fefe3392b1db2f679b3df029d43d8d26d2d
DIFF: https://github.com/llvm/llvm-project/commit/65d15fefe3392b1db2f679b3df029d43d8d26d2d.diff

LOG: [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

Added: 
    

Modified: 
    lldb/include/lldb/Target/TargetList.h
    lldb/source/Target/TargetList.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/TargetList.h b/lldb/include/lldb/Target/TargetList.h
index ff7fbd2753ab..94b25f65863a 100644
--- a/lldb/include/lldb/Target/TargetList.h
+++ b/lldb/include/lldb/Target/TargetList.h
@@ -42,8 +42,6 @@ class TargetList : public Broadcaster {
     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 ce9661ce63c2..2be32c53da9f 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<std::recursive_mutex> guard(m_target_list_mutex);
-  m_target_list.clear();
-}
-
 Status TargetList::CreateTarget(Debugger &debugger,
                                 llvm::StringRef user_exe_path,
                                 llvm::StringRef triple_str,


        


More information about the lldb-commits mailing list