[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:58:13 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: nerix (Nerixyz)
<details>
<summary>Changes</summary>
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).
---
Full diff: https://github.com/llvm/llvm-project/pull/171858.diff
2 Files Affected:
- (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp (+10-2)
- (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py (+2)
``````````diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp
index 52a3d98d2af4b..3e7647be48bb0 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp
@@ -119,8 +119,16 @@ 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);
+ if (!head)
+ return false;
+ 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."""
``````````
</details>
https://github.com/llvm/llvm-project/pull/171858
More information about the lldb-commits
mailing list