[Lldb-commits] [lldb] [LLDB] Fix MS STL `variant` with non-trivial types and PDB (PR #171489)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 11 00:45:32 PST 2025


================
@@ -67,12 +67,18 @@ std::optional<int64_t> GetIndexValue(ValueObject &valobj) {
 ValueObjectSP GetNthStorage(ValueObject &outer, int64_t index) {
   // We need to find the std::_Variant_storage base class.
 
-  // -> std::_SMF_control (typedef to std::_Variant_base)
-  ValueObjectSP container_sp = outer.GetSP()->GetChildAtIndex(0);
-  if (!container_sp)
+  // Navigate "down" to std::_Variant_base by finding the holder of "_Which".
+  // This might be down a few levels if a variant member isn't trivially
+  // destructible/copyable/etc.
+  ValueObjectSP which_sp = outer.GetChildMemberWithName("_Which");
----------------
Michael137 wrote:

Oh the title of this PR answers my question. Yea probably better to do the two changes separately

https://github.com/llvm/llvm-project/pull/171489


More information about the lldb-commits mailing list