Skip to content

Commit 7fdf800

Browse files
authored
[LLDB] Run MSVC variant test with PDB (#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).
1 parent c37c24a commit 7fdf800

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,16 @@ bool formatters::MsvcStlVariantSummaryProvider(
119119
storage_type = storage_type.GetTypedefedType();
120120

121121
CompilerType active_type = storage_type.GetTypeTemplateArgument(1, true);
122-
if (!active_type)
123-
return false;
122+
if (!active_type) {
123+
// PDB: get the type from the head as we don't have template arguments
124+
// there.
125+
ValueObjectSP head = GetHead(*storage);
126+
if (!head)
127+
return false;
128+
active_type = head->GetCompilerType();
129+
if (!active_type)
130+
return false;
131+
}
124132

125133
stream << " Active Type = " << active_type.GetDisplayTypeName() << " ";
126134
return true;

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010

1111
class StdVariantDataFormatterTestCase(TestBase):
12+
TEST_WITH_PDB_DEBUG_INFO = True
13+
1214
def do_test(self):
1315
"""Test that that file and class static variables display correctly."""
1416

0 commit comments

Comments
 (0)