summaryrefslogtreecommitdiff
path: root/lldb/source/DataFormatters/FormattersHelpers.cpp
diff options
context:
space:
mode:
authorshafik <syaghmour@apple.com>2020-03-23 11:42:41 -0700
committershafik <syaghmour@apple.com>2020-03-23 11:48:20 -0700
commita567d6809e1514f34975d746bb1c93301792a74c (patch)
tree94e0f73824ff08677fee2682db41418a3b768123 /lldb/source/DataFormatters/FormattersHelpers.cpp
parent1b9cd51d55b33cfaf68e21fa5396539ca54e5324 (diff)
[DataFormatters] Add formatter for libc++ std::unique_ptr
This adds a formatter for libc++ std::unique_ptr. I also refactored GetValueOfCompressedPair(...) out of LibCxxList.cpp since I need the same functionality and it made sense to share it. Differential Revision: https://reviews.llvm.org/D76476
Diffstat (limited to 'lldb/source/DataFormatters/FormattersHelpers.cpp')
-rw-r--r--lldb/source/DataFormatters/FormattersHelpers.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/DataFormatters/FormattersHelpers.cpp b/lldb/source/DataFormatters/FormattersHelpers.cpp
index 96e93808c18e..7944ff06eee5 100644
--- a/lldb/source/DataFormatters/FormattersHelpers.cpp
+++ b/lldb/source/DataFormatters/FormattersHelpers.cpp
@@ -142,3 +142,14 @@ lldb_private::formatters::GetArrayAddressOrPointerValue(ValueObject &valobj) {
return data_addr;
}
+
+lldb::ValueObjectSP
+lldb_private::formatters::GetValueOfLibCXXCompressedPair(ValueObject &pair) {
+ ValueObjectSP value =
+ pair.GetChildMemberWithName(ConstString("__value_"), true);
+ if (!value) {
+ // pre-r300140 member name
+ value = pair.GetChildMemberWithName(ConstString("__first_"), true);
+ }
+ return value;
+}