[Lldb-commits] [lldb] [lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (PR #77026)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 11 16:24:42 PST 2024
================
@@ -173,21 +173,21 @@ TryCreateAutoSummaryForContainer(lldb::SBValue &v) {
lldb::SBValue child = v.GetChildAtIndex(i);
if (llvm::StringRef name = child.GetName(); !name.empty()) {
- llvm::StringRef value;
+ llvm::StringRef desc;
if (llvm::StringRef summary = child.GetSummary(); !summary.empty())
- value = summary;
+ desc = summary;
+ else if (llvm::StringRef value = child.GetValue(); !value.empty())
+ desc = value;
else
- value = child.GetValue();
-
- if (!value.empty()) {
- // If the child is an indexed entry, we don't show its index to save
- // characters.
- if (name.starts_with("["))
- os << separator << value;
- else
- os << separator << name << ":" << value;
- separator = ", ";
- }
+ desc = "{...}"; // Fallback for nested types.
----------------
clayborg wrote:
"{...}" should only be used for structs unions or classes. We are processing the children of an item. You will need to check the type class so I would recommend:
```
static bool IsClassStructOrUnionType(lldb::SBType t) {
return (t.GetTypeClass() & (lldb::eTypeClassUnion | lldb::eTypeClassStruct | lldb::eTypeClassUnion)) != 0
}
```
Then in the above code:
```
if (IsClassStructOrUnionType(child.GetType())
desc = "{...}"
```
It seems we would want this description for a top level class/struct/union as well
https://github.com/llvm/llvm-project/pull/77026
More information about the lldb-commits
mailing list