Skip to content

Commit 0fe7e98

Browse files
committed
[lldb] Use thread_sp in more places in ThreadList::WillResume()
This makes the code prettier and more consistent.
1 parent 5164b41 commit 0fe7e98

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lldb/source/Target/ThreadList.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,13 @@ bool ThreadList::WillResume() {
528528
bool wants_solo_run = false;
529529

530530
for (pos = m_threads.begin(); pos != end; ++pos) {
531+
ThreadSP thread_sp(*pos);
531532
lldbassert((*pos)->GetCurrentPlan() &&
532533
"thread should not have null thread plan");
533-
if ((*pos)->GetResumeState() != eStateSuspended &&
534-
(*pos)->GetCurrentPlan()->StopOthers()) {
535-
if ((*pos)->IsOperatingSystemPluginThread() &&
536-
!(*pos)->GetBackingThread())
534+
if (thread_sp->GetResumeState() != eStateSuspended &&
535+
thread_sp->GetCurrentPlan()->StopOthers()) {
536+
if (thread_sp->IsOperatingSystemPluginThread() &&
537+
!thread_sp->GetBackingThread())
537538
continue;
538539
wants_solo_run = true;
539540
break;
@@ -546,12 +547,13 @@ bool ThreadList::WillResume() {
546547
// others, only call setup on the threads that request StopOthers...
547548

548549
for (pos = m_threads.begin(); pos != end; ++pos) {
549-
if ((*pos)->GetResumeState() != eStateSuspended &&
550+
ThreadSP thread_sp(*pos);
551+
if (thread_sp->GetResumeState() != eStateSuspended &&
550552
(!wants_solo_run || (*pos)->GetCurrentPlan()->StopOthers())) {
551-
if ((*pos)->IsOperatingSystemPluginThread() &&
552-
!(*pos)->GetBackingThread())
553+
if (thread_sp->IsOperatingSystemPluginThread() &&
554+
!thread_sp->GetBackingThread())
553555
continue;
554-
(*pos)->SetupForResume();
556+
thread_sp->SetupForResume();
555557
}
556558
}
557559

@@ -574,8 +576,8 @@ bool ThreadList::WillResume() {
574576
ThreadSP thread_sp(*pos);
575577
if (thread_sp->GetResumeState() != eStateSuspended &&
576578
thread_sp->GetCurrentPlan()->StopOthers()) {
577-
if ((*pos)->IsOperatingSystemPluginThread() &&
578-
!(*pos)->GetBackingThread())
579+
if (thread_sp->IsOperatingSystemPluginThread() &&
580+
!thread_sp->GetBackingThread())
579581
continue;
580582

581583
// You can't say "stop others" and also want yourself to be suspended.

0 commit comments

Comments
 (0)