[Lldb-commits] [lldb] Make ValueObjectPrinter's handling of its ValueObject pointers more principled (NFC) (PR #81314)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 9 12:51:51 PST 2024


================
@@ -177,7 +177,10 @@ class CommandObjectFrameDiagnose : public CommandObjectParsed {
 
     DumpValueObjectOptions options;
     options.SetDeclPrintingHelper(helper);
-    ValueObjectPrinter printer(valobj_sp.get(), &result.GetOutputStream(),
+    // We've already handled the case where the value object sp is null, so
+    // this is just to make sure future changes don't skip that:
+    assert(valobj_sp.get() && "Must have a valid ValueObject to print");
+    ValueObjectPrinter printer(*(valobj_sp.get()), &result.GetOutputStream(),
----------------
clayborg wrote:

Can this just be:
```
ValueObjectPrinter printer(*valobj_sp, &result.GetOutputStream(),
```

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


More information about the lldb-commits mailing list