[Lldb-commits] [lldb] [lldb] Add/change options in `statistics dump` to control what sections are dumped (PR #95075)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 17 18:00:11 PDT 2024


================
@@ -76,13 +77,22 @@ class CommandObjectStatsDump : public CommandObjectParsed {
         m_all_targets = true;
         break;
       case 's':
-        m_stats_options.summary_only = true;
+        m_stats_options.SetSummaryOnly(true);
         break;
       case 'f':
-        m_stats_options.load_all_debug_info = true;
+        m_stats_options.SetLoadAllDebugInfo(true);
+        break;
+      case 'r':
+        m_stats_options.SetIncludeTargets(OptionArgParser::ToBoolean(
+            "--targets", option_arg, true /* doesn't matter */, error));
----------------
clayborg wrote:

Lets use the new `llvm::Expected<bool> ToBoolean(llvm::StringRef option_arg);` function:
```
if (auto bool_or_error = OptionArgParser::ToBoolean(option_arg))
  m_stats_options.SetIncludeTargets(*bool_or_error);
else
  error.SetErrorStringWithFormat("failed to parse --targets boolean value: %s", llvm::toString(bool_or_error.takeError()).c_str());
```
  

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


More information about the lldb-commits mailing list