Author: Adrian Prantl Date: 2022-05-20T11:25:42-07:00 New Revision: f4570ce442b492d436a0e314c6ea14bf299af0d3
URL: https://github.com/llvm/llvm-project/commit/f4570ce442b492d436a0e314c6ea14bf299af0d3 DIFF: https://github.com/llvm/llvm-project/commit/f4570ce442b492d436a0e314c6ea14bf299af0d3.diff LOG: Adapt C++ std::string dataformatter for D125496 https://reviews.llvm.org/D125496 changed the layout of std::string without updating the LLDB dataformatter. This patch adds code to recognize the new format. Differential Revision: https://reviews.llvm.org/D126080 Added: Modified: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index f8052f62babd3..cd09c3e7d1e9b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -546,7 +546,7 @@ bool lldb_private::formatters::LibcxxContainerSummaryProvider( nullptr, nullptr, &valobj, false, false); } -// the field layout in a libc++ string (cap, side, data or data, size, cap) +/// The field layout in a libc++ string (cap, side, data or data, size, cap). enum LibcxxStringLayoutMode { eLibcxxStringLayoutModeCSD = 0, eLibcxxStringLayoutModeDSC = 1, @@ -626,6 +626,9 @@ ExtractLibcxxStringInfo(ValueObject &valobj) { return {}; ValueObjectSP location_sp = short_sp->GetChildAtIndex( (layout == eLibcxxStringLayoutModeDSC) ? 0 : 1, true); + // After D125496, there is a flat layout. + if (location_sp->GetName() == g_size_name) + location_sp = short_sp->GetChildAtIndex(3, true); if (using_bitmasks) size = (layout == eLibcxxStringLayoutModeDSC) ? size_mode_value _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits