[Lldb-commits] [lldb] [lldb] Make StoppointSite class non-polymorphic (PR #190206)

via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 09:08:59 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Sergei Barannikov (s-barannikov)

<details>
<summary>Changes</summary>

It is never used in polymorphic way.

---
Full diff: https://github.com/llvm/llvm-project/pull/190206.diff


3 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/BreakpointSite.h (+4-4) 
- (modified) lldb/include/lldb/Breakpoint/StoppointSite.h (+4-15) 
- (modified) lldb/include/lldb/Breakpoint/Watchpoint.h (+4-4) 


``````````diff
diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index e189ed77e261b..85685048818da 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -48,7 +48,7 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
   typedef lldb::break_id_t SiteID;
   typedef lldb::break_id_t ConstituentID;
 
-  ~BreakpointSite() override;
+  ~BreakpointSite();
 
   // This section manages the breakpoint traps
 
@@ -100,10 +100,10 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
   /// \return
   ///    \b true if we should stop, \b false otherwise.
   bool ShouldStop(StoppointCallbackContext *context,
-                  BreakpointLocationCollection &stopping_bp_loc) override;
+                  BreakpointLocationCollection &stopping_bp_loc);
 
   /// Standard Dump method
-  void Dump(Stream *s) const override;
+  void Dump(Stream *s) const;
 
   /// The "Constituents" are the breakpoint locations that share this breakpoint
   /// site. The method adds the \a constituent to this breakpoint site's
@@ -198,7 +198,7 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
   ///     \b false otherwise.
   bool IsInternal() const;
 
-  bool IsHardware() const override {
+  bool IsHardware() const {
     lldbassert(BreakpointSite::Type::eHardware == GetType() ||
                !HardwareRequired());
     return BreakpointSite::Type::eHardware == GetType();
diff --git a/lldb/include/lldb/Breakpoint/StoppointSite.h b/lldb/include/lldb/Breakpoint/StoppointSite.h
index 2ceac403940ef..1dfee34daa87b 100644
--- a/lldb/include/lldb/Breakpoint/StoppointSite.h
+++ b/lldb/include/lldb/Breakpoint/StoppointSite.h
@@ -22,11 +22,9 @@ class StoppointSite {
   StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr,
                 uint32_t byte_size, bool hardware);
 
-  virtual ~StoppointSite() = default;
+  lldb::addr_t GetLoadAddress() const { return m_addr; }
 
-  virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
-
-  virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
+  void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
 
   uint32_t GetByteSize() const { return m_byte_size; }
 
@@ -36,17 +34,6 @@ class StoppointSite {
 
   bool HardwareRequired() const { return m_is_hardware_required; }
 
-  virtual bool IsHardware() const = 0;
-
-  virtual bool ShouldStop(StoppointCallbackContext *context) { return false; };
-
-  virtual bool ShouldStop(StoppointCallbackContext *context,
-                          BreakpointLocationCollection &stopping_bp_locs) {
-    return false;
-  };
-
-  virtual void Dump(Stream* stream) const = 0;
-
   lldb::break_id_t GetID() const { return m_id; }
 
 protected:
@@ -68,6 +55,8 @@ class StoppointSite {
   /// Number of times this breakpoint/watchpoint has been hit.
   StoppointHitCounter m_hit_counter;
 
+  ~StoppointSite() = default;
+
 private:
   StoppointSite(const StoppointSite &) = delete;
   const StoppointSite &operator=(const StoppointSite &) = delete;
diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h b/lldb/include/lldb/Breakpoint/Watchpoint.h
index ca48a0114888a..72246f9f15de6 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -61,7 +61,7 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
   Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
              const CompilerType *type, bool hardware = true);
 
-  ~Watchpoint() override;
+  ~Watchpoint();
 
   bool IsEnabled() const;
 
@@ -70,9 +70,9 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
   // be used instead.
   void SetEnabled(bool enabled, bool notify = true);
 
-  bool IsHardware() const override;
+  bool IsHardware() const;
 
-  bool ShouldStop(StoppointCallbackContext *context) override;
+  bool ShouldStop(StoppointCallbackContext *context);
 
   bool WatchpointRead() const;
   bool WatchpointWrite() const;
@@ -125,7 +125,7 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
       lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level);
-  void Dump(Stream *s) const override;
+  void Dump(Stream *s) const;
   bool DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
   void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
   Target &GetTarget() { return m_target; }

``````````

</details>


https://github.com/llvm/llvm-project/pull/190206


More information about the lldb-commits mailing list