kastiglione created this revision.
kastiglione added a reviewer: jingham.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The calls to `ThreadPlan::WillStop` do not use the return value. This changes 
`WillStop`
to a `void` return type, and since most subclasses don't implement this event, 
the base
class is given an empty implementation, instead of being pure virtual.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96656

Files:
  lldb/include/lldb/Target/ThreadPlan.h
  lldb/include/lldb/Target/ThreadPlanBase.h
  lldb/include/lldb/Target/ThreadPlanCallFunction.h
  lldb/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
  lldb/include/lldb/Target/ThreadPlanPython.h
  lldb/include/lldb/Target/ThreadPlanRunToAddress.h
  lldb/include/lldb/Target/ThreadPlanStepInstruction.h
  lldb/include/lldb/Target/ThreadPlanStepOut.h
  lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
  lldb/include/lldb/Target/ThreadPlanStepRange.h
  lldb/include/lldb/Target/ThreadPlanStepThrough.h
  lldb/include/lldb/Target/ThreadPlanStepUntil.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
  lldb/source/Target/ThreadPlan.cpp
  lldb/source/Target/ThreadPlanBase.cpp
  lldb/source/Target/ThreadPlanCallFunction.cpp
  lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
  lldb/source/Target/ThreadPlanPython.cpp
  lldb/source/Target/ThreadPlanRunToAddress.cpp
  lldb/source/Target/ThreadPlanStepInstruction.cpp
  lldb/source/Target/ThreadPlanStepOut.cpp
  lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
  lldb/source/Target/ThreadPlanStepRange.cpp
  lldb/source/Target/ThreadPlanStepThrough.cpp
  lldb/source/Target/ThreadPlanStepUntil.cpp

Index: lldb/source/Target/ThreadPlanStepUntil.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepUntil.cpp
+++ lldb/source/Target/ThreadPlanStepUntil.cpp
@@ -295,7 +295,7 @@
   return true;
 }
 
-bool ThreadPlanStepUntil::WillStop() {
+void ThreadPlanStepUntil::WillStop() {
   Target &target = GetTarget();
   Breakpoint *return_bp = target.GetBreakpointByID(m_return_bp_id).get();
   if (return_bp != nullptr)
@@ -307,7 +307,6 @@
     if (until_bp != nullptr)
       until_bp->SetEnabled(false);
   }
-  return true;
 }
 
 bool ThreadPlanStepUntil::MischiefManaged() {
Index: lldb/source/Target/ThreadPlanStepThrough.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepThrough.cpp
+++ lldb/source/Target/ThreadPlanStepThrough.cpp
@@ -217,8 +217,6 @@
   return true;
 }
 
-bool ThreadPlanStepThrough::WillStop() { return true; }
-
 void ThreadPlanStepThrough::ClearBackstopBreakpoint() {
   if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) {
     m_process.GetTarget().RemoveBreakpointByID(m_backstop_bkpt_id);
Index: lldb/source/Target/ThreadPlanStepRange.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepRange.cpp
+++ lldb/source/Target/ThreadPlanStepRange.cpp
@@ -422,8 +422,6 @@
   }
 }
 
-bool ThreadPlanStepRange::WillStop() { return true; }
-
 StateType ThreadPlanStepRange::GetPlanRunState() {
   if (m_next_branch_bp_sp)
     return eStateRunning;
Index: lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
+++ lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
@@ -129,9 +129,8 @@
   return true;
 }
 
-bool ThreadPlanStepOverBreakpoint::WillStop() {
+void ThreadPlanStepOverBreakpoint::WillStop() {
   ReenableBreakpointSite();
-  return true;
 }
 
 void ThreadPlanStepOverBreakpoint::WillPop() {
Index: lldb/source/Target/ThreadPlanStepOut.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepOut.cpp
+++ lldb/source/Target/ThreadPlanStepOut.cpp
@@ -404,14 +404,12 @@
   return true;
 }
 
-bool ThreadPlanStepOut::WillStop() {
+void ThreadPlanStepOut::WillStop() {
   if (m_return_bp_id != LLDB_INVALID_BREAK_ID) {
     Breakpoint *return_bp = GetTarget().GetBreakpointByID(m_return_bp_id).get();
     if (return_bp != nullptr)
       return_bp->SetEnabled(false);
   }
-
-  return true;
 }
 
 bool ThreadPlanStepOut::MischiefManaged() {
Index: lldb/source/Target/ThreadPlanStepInstruction.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepInstruction.cpp
+++ lldb/source/Target/ThreadPlanStepInstruction.cpp
@@ -239,8 +239,6 @@
   return eStateStepping;
 }
 
-bool ThreadPlanStepInstruction::WillStop() { return true; }
-
 bool ThreadPlanStepInstruction::MischiefManaged() {
   if (IsPlanComplete()) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Index: lldb/source/Target/ThreadPlanRunToAddress.cpp
===================================================================
--- lldb/source/Target/ThreadPlanRunToAddress.cpp
+++ lldb/source/Target/ThreadPlanRunToAddress.cpp
@@ -166,8 +166,6 @@
 
 StateType ThreadPlanRunToAddress::GetPlanRunState() { return eStateRunning; }
 
-bool ThreadPlanRunToAddress::WillStop() { return true; }
-
 bool ThreadPlanRunToAddress::MischiefManaged() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
Index: lldb/source/Target/ThreadPlanPython.cpp
===================================================================
--- lldb/source/Target/ThreadPlanPython.cpp
+++ lldb/source/Target/ThreadPlanPython.cpp
@@ -168,9 +168,8 @@
             m_class_name.c_str());
 }
 
-bool ThreadPlanPython::WillStop() {
+void ThreadPlanPython::WillStop() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
   LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
             m_class_name.c_str());
-  return true;
 }
Index: lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
===================================================================
--- lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
+++ lldb/source/Target/ThreadPlanCallOnFunctionExit.cpp
@@ -76,13 +76,6 @@
   return false;
 }
 
-bool ThreadPlanCallOnFunctionExit::WillStop() {
-  // The code looks like the return value is ignored via ThreadList::
-  // ShouldStop(). This is called when we really are going to stop.  We don't
-  // care and don't need to do anything here.
-  return false;
-}
-
 bool ThreadPlanCallOnFunctionExit::DoPlanExplainsStop(Event *event_ptr) {
   // We don't ever explain a stop.  The only stop that is relevant to us
   // directly is the step_out plan we added to do the heavy lifting of getting
Index: lldb/source/Target/ThreadPlanCallFunction.cpp
===================================================================
--- lldb/source/Target/ThreadPlanCallFunction.cpp
+++ lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -379,8 +379,6 @@
 #endif
 }
 
-bool ThreadPlanCallFunction::WillStop() { return true; }
-
 bool ThreadPlanCallFunction::MischiefManaged() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
Index: lldb/source/Target/ThreadPlanBase.cpp
===================================================================
--- lldb/source/Target/ThreadPlanBase.cpp
+++ lldb/source/Target/ThreadPlanBase.cpp
@@ -179,8 +179,6 @@
 
 StateType ThreadPlanBase::GetPlanRunState() { return eStateRunning; }
 
-bool ThreadPlanBase::WillStop() { return true; }
-
 bool ThreadPlanBase::DoWillResume(lldb::StateType resume_state,
                                   bool current_plan) {
   // Reset these to the default values so we don't set them wrong, then not get
Index: lldb/source/Target/ThreadPlan.cpp
===================================================================
--- lldb/source/Target/ThreadPlan.cpp
+++ lldb/source/Target/ThreadPlan.cpp
@@ -142,6 +142,8 @@
   return success;
 }
 
+void ThreadPlan::WillStop() {}
+
 lldb::user_id_t ThreadPlan::GetNextID() {
   static uint32_t g_nextPlanID = 0;
   return ++g_nextPlanID;
@@ -221,7 +223,7 @@
   return true;
 }
 
-bool ThreadPlanNull::WillStop() {
+void ThreadPlanNull::WillStop() {
 #ifdef LLDB_CONFIGURATION_DEBUG
   fprintf(stderr,
           "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64
@@ -234,7 +236,6 @@
                ", ptid = 0x%" PRIx64 ")",
                LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID());
 #endif
-  return true;
 }
 
 bool ThreadPlanNull::DoPlanExplainsStop(Event *event_ptr) {
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
@@ -48,8 +48,6 @@
 
   void DidPush() override;
 
-  bool WillStop() override;
-
 protected:
   bool DoPlanExplainsStop(Event *event_ptr) override;
 
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -194,8 +194,6 @@
   return IsPlanComplete();
 }
 
-bool AppleThreadPlanStepThroughObjCTrampoline::WillStop() { return true; }
-
 // Objective-C uses optimized dispatch functions for some common and seldom
 // overridden methods.  For instance
 //      [object respondsToSelector:];
Index: lldb/include/lldb/Target/ThreadPlanStepUntil.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStepUntil.h
+++ lldb/include/lldb/Target/ThreadPlanStepUntil.h
@@ -23,7 +23,7 @@
   bool ShouldStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
+  void WillStop() override;
   bool MischiefManaged() override;
 
 protected:
Index: lldb/include/lldb/Target/ThreadPlanStepThrough.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStepThrough.h
+++ lldb/include/lldb/Target/ThreadPlanStepThrough.h
@@ -23,7 +23,6 @@
   bool ShouldStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
   bool MischiefManaged() override;
   void DidPush() override;
 
Index: lldb/include/lldb/Target/ThreadPlanStepRange.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStepRange.h
+++ lldb/include/lldb/Target/ThreadPlanStepRange.h
@@ -33,7 +33,6 @@
   Vote ShouldReportStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
   bool MischiefManaged() override;
   void DidPush() override;
   bool IsPlanStale() override;
Index: lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
+++ lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
@@ -25,7 +25,7 @@
   bool ShouldStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
+  void WillStop() override;
   void WillPop() override;
   bool MischiefManaged() override;
   void ThreadDestroyed() override;
Index: lldb/include/lldb/Target/ThreadPlanStepOut.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStepOut.h
+++ lldb/include/lldb/Target/ThreadPlanStepOut.h
@@ -31,7 +31,7 @@
   bool ShouldStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
+  void WillStop() override;
   bool MischiefManaged() override;
   void DidPush() override;
   bool IsPlanStale() override;
Index: lldb/include/lldb/Target/ThreadPlanStepInstruction.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStepInstruction.h
+++ lldb/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -27,7 +27,6 @@
   bool ShouldStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
   bool MischiefManaged() override;
   bool IsPlanStale() override;
 
Index: lldb/include/lldb/Target/ThreadPlanRunToAddress.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanRunToAddress.h
+++ lldb/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -41,8 +41,6 @@
 
   lldb::StateType GetPlanRunState() override;
 
-  bool WillStop() override;
-
   bool MischiefManaged() override;
 
 protected:
Index: lldb/include/lldb/Target/ThreadPlanPython.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanPython.h
+++ lldb/include/lldb/Target/ThreadPlanPython.h
@@ -43,7 +43,7 @@
 
   bool MischiefManaged() override;
 
-  bool WillStop() override;
+  void WillStop() override;
 
   bool StopOthers() override { return m_stop_others; }
 
Index: lldb/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
+++ lldb/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
@@ -37,8 +37,6 @@
 
   bool ShouldStop(Event *event_ptr) override;
 
-  bool WillStop() override;
-
 protected:
   bool DoPlanExplainsStop(Event *event_ptr) override;
 
Index: lldb/include/lldb/Target/ThreadPlanCallFunction.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -46,8 +46,6 @@
 
   void DidPush() override;
 
-  bool WillStop() override;
-
   bool MischiefManaged() override;
 
   // To get the return value from a function call you must create a
Index: lldb/include/lldb/Target/ThreadPlanBase.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanBase.h
+++ lldb/include/lldb/Target/ThreadPlanBase.h
@@ -31,7 +31,6 @@
   Vote ShouldReportStop(Event *event_ptr) override;
   bool StopOthers() override;
   lldb::StateType GetPlanRunState() override;
-  bool WillStop() override;
   bool MischiefManaged() override;
 
   bool OkayToDiscard() override { return false; }
Index: lldb/include/lldb/Target/ThreadPlan.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlan.h
+++ lldb/include/lldb/Target/ThreadPlan.h
@@ -377,7 +377,7 @@
   // then calls DoWillResume.
   bool WillResume(lldb::StateType resume_state, bool current_plan);
 
-  virtual bool WillStop() = 0;
+  virtual void WillStop();
 
   bool IsMasterPlan() { return m_is_master_plan; }
 
@@ -579,7 +579,7 @@
 
   bool MischiefManaged() override;
 
-  bool WillStop() override;
+  void WillStop() override;
 
   bool IsBasePlan() override { return true; }
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to