[Lldb-commits] [lldb] Support statistics dump summary only mode (PR #80745)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 5 20:52:03 PST 2024


================
@@ -0,0 +1,31 @@
+//===-- SBStatisticsOptions.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SBSTATISTICSOPTIONS_H
+#define LLDB_API_SBSTATISTICSOPTIONS_H
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBStatisticsOptions {
+public:
+  SBStatisticsOptions();
+  SBStatisticsOptions(const lldb::SBStatisticsOptions &rhs);
+  ~SBStatisticsOptions();
+
+  const SBStatisticsOptions &operator=(const lldb::SBStatisticsOptions &rhs);
+
+  void SetSummaryOnly(bool b);
+  lldb_private::StatisticsOptions GetStatisticsOptions();
----------------
clayborg wrote:

We don't want this function to be public, it should be protected, and not return an instance of `lldb_private::StatisticsOptions`, cause if we do this, then we need to include the header file that defines this data structure and it should be opaque. In a class like SBAddress, we do something like this:
```
class SBStatisticsOptions {
  ...
protected:
  friend class SBTarget;
  const lldb_private::StatisticsOptions &ref() const;
}
```
If this is a `lldb_private::StatisticsOptions &`, then we don't need to include the header file that defines this structure in this file since the size of a references is just a pointer size.

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


More information about the lldb-commits mailing list