Skip to content

Commit 4542841

Browse files
committed
[lldb] Adjust libc++ string formatter for changes in D122598
The __size_ member is now in a slightly different location.
1 parent f9c2f82 commit 4542841

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,17 +578,21 @@ ExtractLibcxxStringInfo(ValueObject &valobj) {
578578
uint64_t size_mode_value = 0;
579579

580580
if (layout == eLibcxxStringLayoutModeDSC) {
581-
ValueObjectSP size_mode(D->GetChildAtIndexPath({1, 1, 0}));
581+
llvm::SmallVector<size_t, 3> size_mode_locations[] = {
582+
{1, 2}, // Post-c3d0205ee771 layout
583+
{1, 1, 0},
584+
{1, 1, 1},
585+
};
586+
ValueObjectSP size_mode;
587+
for (llvm::ArrayRef<size_t> loc : size_mode_locations) {
588+
size_mode = D->GetChildAtIndexPath(loc);
589+
if (size_mode && size_mode->GetName() == g_size_name)
590+
break;
591+
}
592+
582593
if (!size_mode)
583594
return {};
584595

585-
if (size_mode->GetName() != g_size_name) {
586-
// we are hitting the padding structure, move along
587-
size_mode = D->GetChildAtIndexPath({1, 1, 1});
588-
if (!size_mode)
589-
return {};
590-
}
591-
592596
size_mode_value = (size_mode->GetValueAsUnsigned(0));
593597
short_mode = ((size_mode_value & 0x80) == 0);
594598
} else {

0 commit comments

Comments
 (0)