[Lldb-commits] [lldb] 1da4494 - [lldb] Add comment on cross printing of summary/value (#81681)

via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 14 13:13:27 PST 2024


Author: Dave Lee
Date: 2024-02-14T13:13:23-08:00
New Revision: 1da4494184566d68f32206e3ac5a8b90bc05889d

URL: https://github.com/llvm/llvm-project/commit/1da4494184566d68f32206e3ac5a8b90bc05889d
DIFF: https://github.com/llvm/llvm-project/commit/1da4494184566d68f32206e3ac5a8b90bc05889d.diff

LOG: [lldb] Add comment on cross printing of summary/value (#81681)

Adds a comment to indicate intention of a piece of value printing code.

I was initially surprised to see this code (distilled for emphasis):

```cpp
if (str.empty()) {
  if (style == eValueObjectRepresentationStyleValue)
    str = GetSummaryAsCString();
  else if (style == eValueObjectRepresentationStyleSummary)
    str = GetValueAsCString();
}
```

My first thought was "is this a bug?", but I realized it was likely intentional. This 
change adds a comment to indicate yes, this is intentional.

Added: 
    

Modified: 
    lldb/source/Core/ValueObject.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index e80042826f7d64..840b100c70ddaa 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1312,6 +1312,8 @@ bool ValueObject::DumpPrintableRepresentation(
       break;
     }
 
+    // If the requested display style produced no output, try falling back to
+    // alternative presentations.
     if (str.empty()) {
       if (val_obj_display == eValueObjectRepresentationStyleValue)
         str = GetSummaryAsCString();


        


More information about the lldb-commits mailing list