[Lldb-commits] [lldb] Make ValueObjectPrinter's handling of its ValueObject pointers more principled (NFC) (PR #81314)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 9 14:05:47 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");
----------------
jimingham wrote:
I'm of two minds about this. The current code does:
if (!valobj_sp) {
// do some error handling
return;
}
// enough code to push this check off the top of your monitor screen
Then this code. So I could have just duplicated the check & error handling again before printing the thing, but that looked bogus to me. OTOH, I don't want someone to forget check, so I put in the assert, so if one of us accidentally deletes the check, we'll know.
But if that bugs you I'm happy to cut and paste the error handling here again. It just looked weird to me.
https://github.com/llvm/llvm-project/pull/81314
More information about the lldb-commits
mailing list