================
@@ -133,7 +133,9 @@ struct ConstStringStats {
 struct StatisticsOptions {
   bool summary_only = false;
   bool load_all_debug_info = false;
-  bool include_transcript = false;
+  bool include_targets = true;
+  bool include_modules = true;
----------------
clayborg wrote:

Do we want to make all of the StatisticsOptions bool values 
`std::optional<bool>` values? Then we will know if the user has set them and we 
can do the reasoning. Accessors can be added to this `StatisticsOptions` class 
to do the right thing. Then instead of people directly accessing each 
`std::optional<bool>` we would have accessors. Something like:
```
class StatisticsOptions {
private: // Stop direct access to the member variables
  std::optional<bool> m_summary_only;
  std::optional<bool> m_load_all_debug_info;
  std::optional<bool> m_include_transcript;
  std::optional<bool> m_include_targets;
  std::optional<bool> m_include_modules;
public:
  // Summary only defaults to false.
  bool GetSummaryOnly() const { return m_summary_only.value_or(false); }
  void SetSummaryOnly(bool value) { m_summary_only = value; }
  // Now we can reason about what values to return depending on m_summary_only:
  bool GetIncludeTargets() const {
    if (m_include_targets.has_value())
      return m_include_targets.value();
    // m_include_targets has no value set, so return a value base on 
m_summary_only
    return !GetSummaryOnly();
  }
```
Then this allows you to always do the right thing depending on what options 
people select.

https://github.com/llvm/llvm-project/pull/95075
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to