[PATCH 50/61] Remove has_locator method

Tom Tromey tom@tromey.com
Thu Jul 4 17:26:00 GMT 2019


Earlier changes made it obvious that the has_locator method can only
be called for source/disassembly windows.  Because the only reference
to this now occurs in methods on this object, we can remove the
has_locator method entirely, in favor of using the member directly.

2019-07-04  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_source_window_base::set_new_height)
	(tui_source_window_base::do_make_visible_with_new_height): Use
	m_has_locator field directly.
	* tui/tui-data.h (struct tui_win_info) <has_locator>: Remove
	method.
	(struct tui_source_window_base) <has_locator>: Likewise.
---
 gdb/ChangeLog      |  9 +++++++++
 gdb/tui/tui-data.h | 12 ------------
 gdb/tui/tui-win.c  |  4 ++--
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 3c34bd31961..a95f4272e57 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -295,12 +295,6 @@ public:
   /* Clear the pertinent detail in the window.  */
   virtual void clear_detail () = 0;
 
-  /* Return true if this window has the locator.  */
-  virtual bool has_locator () const
-  {
-    return false;
-  }
-
   /* Called after all the TUI windows are refreshed, to let this
      window have a chance to update itself further.  */
   virtual void refresh_all ()
@@ -368,12 +362,6 @@ public:
 
   void clear_detail () override;
 
-  /* Return true if this window has the locator.  */
-  bool has_locator () const override
-  {
-    return m_has_locator;
-  }
-
   void make_visible (bool visible) override;
   void refresh_window () override;
   void refresh_all () override;
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index c92a706efc6..2fb757a6a4d 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1235,7 +1235,7 @@ tui_source_window_base::set_new_height (int height)
     execution_info->viewport_height = height;
   execution_info->viewport_height--;
 
-  if (has_locator ())
+  if (m_has_locator)
     {
       tui_locator_window *gen_win_info = tui_locator_win_info_ptr ();
       gen_win_info->make_visible (false);
@@ -1324,7 +1324,7 @@ tui_source_window_base::do_make_visible_with_new_height ()
 	}
       tui_update_source_window (this, gdbarch, s, line, TRUE);
     }
-  if (has_locator ())
+  if (m_has_locator)
     {
       tui_locator_win_info_ptr ()->make_visible (true);
       tui_show_locator_content ();
-- 
2.17.2



More information about the Gdb-patches mailing list