aboutsummaryrefslogtreecommitdiff
path: root/source/DataFormatters/VectorType.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/DataFormatters/VectorType.cpp')
-rw-r--r--source/DataFormatters/VectorType.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/source/DataFormatters/VectorType.cpp b/source/DataFormatters/VectorType.cpp
index 57bf696ba4fa..316d7b540bcd 100644
--- a/source/DataFormatters/VectorType.cpp
+++ b/source/DataFormatters/VectorType.cpp
@@ -7,9 +7,10 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/VectorType.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/CXXFormatterFunctions.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"
@@ -267,6 +268,51 @@ namespace lldb_private {
}
}
+bool
+lldb_private::formatters::VectorTypeSummaryProvider (ValueObject& valobj,
+ Stream& s,
+ const TypeSummaryOptions&)
+{
+ auto synthetic_children = VectorTypeSyntheticFrontEndCreator(nullptr, valobj.GetSP());
+ if (!synthetic_children)
+ return false;
+
+ synthetic_children->Update();
+
+ s.PutChar('(');
+ bool first = true;
+
+ size_t idx = 0, len = synthetic_children->CalculateNumChildren();
+
+ for (;
+ idx < len;
+ idx++)
+ {
+ auto child_sp = synthetic_children->GetChildAtIndex(idx);
+ if (!child_sp)
+ continue;
+ child_sp = child_sp->GetQualifiedRepresentationIfAvailable(lldb::eDynamicDontRunTarget, true);
+
+ const char* child_value = child_sp->GetValueAsCString();
+ if (child_value && *child_value)
+ {
+ if (first)
+ {
+ s.Printf("%s", child_value);
+ first = false;
+ }
+ else
+ {
+ s.Printf(", %s", child_value);
+ }
+ }
+ }
+
+ s.PutChar(')');
+
+ return true;
+}
+
lldb_private::SyntheticChildrenFrontEnd*
lldb_private::formatters::VectorTypeSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
{