Skip to content

Commit

Permalink
[TargetList] Delete the destructor
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vedantk committed Nov 6, 2020
1 parent 4fcdfc4 commit 65d15fe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
2 changes: 0 additions & 2 deletions lldb/include/lldb/Target/TargetList.h
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions lldb/source/Target/TargetList.cpp
Expand Up @@ -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,
Expand Down

0 comments on commit 65d15fe

Please sign in to comment.