File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
lldb/source/Plugins/Language/CPlusPlus Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,18 @@ std::optional<int64_t> GetIndexValue(ValueObject &valobj) {
6969}
7070
7171ValueObjectSP GetNthStorage (ValueObject &outer, int64_t index) {
72- // We need to find the std::_Variant_storage base class.
73-
74- // -> std::_SMF_control (typedef to std::_Variant_base)
75- ValueObjectSP container_sp = outer.GetSP ()-> GetChildAtIndex ( 0 );
76- if (!container_sp )
72+ // navigate "down" to std::_SMF_control/std::_Variant_base
73+ // by finding the holder of "_Which". This might be down a few levels if a
74+ // variant member isn't trivally destructible/copyable/etc.
75+ ValueObjectSP which_sp = outer.GetChildMemberWithName ( " _Which " );
76+ if (!which_sp )
7777 return nullptr ;
78- // -> std::_Variant_storage
79- container_sp = container_sp->GetChildAtIndex (0 );
78+ ValueObject *parent = which_sp->GetParent ();
79+ if (!parent)
80+ return nullptr ;
81+
82+ // Now go to std::_Variant_storage
83+ ValueObjectSP container_sp = parent->GetChildAtIndex (0 );
8084 if (!container_sp)
8185 return nullptr ;
8286
You can’t perform that action at this time.
0 commit comments