[Lldb-commits] [PATCH] D77153: [lldb/DataFormatters] Display null C++ pointers as nullptr

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 11 17:36:49 PST 2020


jingham accepted this revision.
jingham added a comment.

It seems weird that even if you had a summary formatter for some pointer type that was trying to print "DANGER WILL ROBINSON" when the pointer value was 0x0, we will override that and print "nullptr" in a C++ context or "nil" in an ObjC context.  Seems like we even if the value is Nil we should first consult the ValueObject's summary value and only do the nullptr/nil computation if it was empty.

But that bad behavior was already present for ObjC objects before this patch, you're just extending it to C++ or anything else that implements IsNilReference.  So fixing that doesn't seem required for this patch.



================
Comment at: lldb/source/DataFormatters/ValueObjectPrinter.cpp:368
+      summary.assign(lang_plugin->GetNilReferenceSummaryString().str());
+  } else if (IsUninitialized()) {
+    summary.assign("<uninitialized>");
----------------
If you wanted to you could check here if the languages hadn't assigned anything to Summary, and default to "NULL"?  That would be consistent with our treating C as the fallback language rather than as a separate Language plugin.  Not required...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77153/new/

https://reviews.llvm.org/D77153



More information about the lldb-commits mailing list