Skip to content

Commit 12b4e32

Browse files
committed
fix(optional): try searching for _Value first
1 parent 119861a commit 12b4e32

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,16 @@ ValueObjectSP GenericOptionalFrontend::GetChildAtIndex(uint32_t _idx) {
117117
ValueObjectSP candidate = val_sp->GetChildMemberWithName("_M_value");
118118
if (candidate)
119119
val_sp = candidate;
120-
} else if (m_stdlib == StdLib::MsvcStl)
121-
// Same issue as with LibCxx
122-
val_sp = m_backend.GetChildMemberWithName("_Has_value")
123-
->GetParent()
124-
->GetChildAtIndex(0)
125-
->GetChildMemberWithName("_Value");
120+
} else if (m_stdlib == StdLib::MsvcStl) {
121+
// PDB flattens anonymous unions to the parent
122+
val_sp = m_backend.GetChildMemberWithName("_Value");
123+
// With DWARF and NativePDB, same issue as with LibCxx
124+
if (!val_sp)
125+
val_sp = m_backend.GetChildMemberWithName("_Has_value")
126+
->GetParent()
127+
->GetChildAtIndex(0)
128+
->GetChildMemberWithName("_Value");
129+
}
126130

127131
if (!val_sp)
128132
return ValueObjectSP();

0 commit comments

Comments
 (0)