[Lldb-commits] [lldb] [LLDB] Run MSVC variant test with PDB (PR #171858)

via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 11 08:04:20 PST 2025


https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/171858

Split off from #171489. This only adds the lookup of the active type for a `std::variant` based on the head type (since PDB doesn't have template info).

>From dc76f82f9b3356aac7299f1cb6e2ad77e59b53c9 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Thu, 11 Dec 2025 16:59:48 +0100
Subject: [PATCH] [LLDB] Run MSVC variant test with PDB

---
 .../Plugins/Language/CPlusPlus/MsvcStlVariant.cpp      | 10 ++++++++--
 .../generic/variant/TestDataFormatterStdVariant.py     |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp
index 52a3d98d2af4b..ecf4a3220cd9f 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp
@@ -119,8 +119,14 @@ bool formatters::MsvcStlVariantSummaryProvider(
     storage_type = storage_type.GetTypedefedType();
 
   CompilerType active_type = storage_type.GetTypeTemplateArgument(1, true);
-  if (!active_type)
-    return false;
+  if (!active_type) {
+    // PDB: get the type from the head as we don't have template arguments
+    // there.
+    ValueObjectSP head = GetHead(*storage);
+    active_type = head->GetCompilerType();
+    if (!active_type)
+      return false;
+  }
 
   stream << " Active Type = " << active_type.GetDisplayTypeName() << " ";
   return true;
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py
index 9f32ad97c1f0a..1ae07a91dfe3d 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py
@@ -9,6 +9,8 @@
 
 
 class StdVariantDataFormatterTestCase(TestBase):
+    TEST_WITH_PDB_DEBUG_INFO = True
+
     def do_test(self):
         """Test that that file and class static variables display correctly."""
 



More information about the lldb-commits mailing list