[Lldb-commits] [PATCH] D106171: [lldb] Avoid moving ThreadPlanSP from plans vector

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 16 16:17:04 PDT 2021


kastiglione updated this revision to Diff 359474.
kastiglione added a comment.

Also call pop_back just after retrieving back.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106171/new/

https://reviews.llvm.org/D106171

Files:
  lldb/source/Target/ThreadPlanStack.cpp


Index: lldb/source/Target/ThreadPlanStack.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStack.cpp
+++ lldb/source/Target/ThreadPlanStack.cpp
@@ -142,20 +142,20 @@
 lldb::ThreadPlanSP ThreadPlanStack::PopPlan() {
   assert(m_plans.size() > 1 && "Can't pop the base thread plan");
 
-  lldb::ThreadPlanSP plan_sp = std::move(m_plans.back());
+  lldb::ThreadPlanSP plan_sp = m_plans.back();
+  m_plans.pop_back();
   m_completed_plans.push_back(plan_sp);
   plan_sp->WillPop();
-  m_plans.pop_back();
   return plan_sp;
 }
 
 lldb::ThreadPlanSP ThreadPlanStack::DiscardPlan() {
   assert(m_plans.size() > 1 && "Can't discard the base thread plan");
 
-  lldb::ThreadPlanSP plan_sp = std::move(m_plans.back());
+  lldb::ThreadPlanSP plan_sp = m_plans.back();
+  m_plans.pop_back();
   m_discarded_plans.push_back(plan_sp);
   plan_sp->WillPop();
-  m_plans.pop_back();
   return plan_sp;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106171.359474.patch
Type: text/x-patch
Size: 948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210716/2853f24b/attachment.bin>


More information about the lldb-commits mailing list