[Lldb-commits] [lldb] c29a51b - [lldb][gui] remove the "expand" diamond for variables where expanding fails
Luboš Luňák via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 7 13:00:13 PDT 2022
Author: Luboš Luňák
Date: 2022-04-07T21:59:18+02:00
New Revision: c29a51b3a257908aebc01cd7c4655665db317d66
URL: https://github.com/llvm/llvm-project/commit/c29a51b3a257908aebc01cd7c4655665db317d66
DIFF: https://github.com/llvm/llvm-project/commit/c29a51b3a257908aebc01cd7c4655665db317d66.diff
LOG: [lldb][gui] remove the "expand" diamond for variables where expanding fails
If the variables view shows a variable that is a struct that has
MightHaveChildren(), the expand diamond is shown, but if trying to expand
it and it's not possible (e.g. incomplete type), remove the expand diamond
to visualize that it can't be in fact expanded. Otherwise it feels kinda
weird that a tree item cannot be expanded even though it "should".
I guess the MightHaveChildren() checking means that GetChildren() may
be expensive, so also do not call it for rows that are not expanded.
Differential Revision: https://reviews.llvm.org/D123008
Added:
Modified:
lldb/source/Core/IOHandlerCursesGUI.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index c8d86f0e1128a..0151255631bf8 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -4537,7 +4537,8 @@ struct Row {
if (parent)
parent->DrawTreeForChild(window, this, 0);
- if (might_have_children) {
+ if (might_have_children &&
+ (!calculated_children || !GetChildren().empty())) {
// It we can get UTF8 characters to work we should try to use the
// "symbol" UTF8 string below
// const char *symbol = "";
@@ -5824,9 +5825,11 @@ class ValueObjectListDelegate : public WindowDelegate {
++m_num_rows;
}
- auto &children = row.GetChildren();
- if (row.expanded && !children.empty()) {
- DisplayRows(window, children, options);
+ if (row.expanded) {
+ auto &children = row.GetChildren();
+ if (!children.empty()) {
+ DisplayRows(window, children, options);
+ }
}
}
}
@@ -5847,11 +5850,13 @@ class ValueObjectListDelegate : public WindowDelegate {
return &row;
else {
--row_index;
- auto &children = row.GetChildren();
- if (row.expanded && !children.empty()) {
- Row *result = GetRowForRowIndexImpl(children, row_index);
- if (result)
- return result;
+ if (row.expanded) {
+ auto &children = row.GetChildren();
+ if (!children.empty()) {
+ Row *result = GetRowForRowIndexImpl(children, row_index);
+ if (result)
+ return result;
+ }
}
}
}
More information about the lldb-commits
mailing list