Skip to content

Commit a0b203a

Browse files
committed
[lldb] Support counting the children of metatypes using reflection metadata
This eliminates yet another SwiftASTContext fallback. rdar://151330021
1 parent cf4a54e commit a0b203a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
15421542
// consider handling them here, but
15431543
// TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex can also
15441544
// handle them and without a Process.
1545-
if (!TypeSystemSwiftTypeRef::IsBuiltinType(m_type)) {
1545+
if (!TypeSystemSwiftTypeRef::IsBuiltinType(m_type) &&
1546+
!Flags(m_type.GetTypeInfo()).AnySet(eTypeIsMetatype)) {
15461547
LLDB_LOG(GetLog(LLDBLog::Types),
15471548
"{0}: unrecognized builtin type info or this is a Clang type "
15481549
"without DWARF debug info",

lldb/test/API/lang/swift/metatype/TestSwiftMetatype.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ def test_metatype(self):
2929

3030
frame = thread.frames[0]
3131
self.assertTrue(frame, "Frame 0 is valid.")
32-
3332
var_s = frame.FindVariable("s")
3433
var_c = frame.FindVariable("c")
3534
var_f = frame.FindVariable("f")
3635
var_t = frame.FindVariable("t")
3736
var_p = frame.FindVariable("p")
37+
self.assertEqual(var_s.GetNumChildren(), 0)
38+
self.assertEqual(var_c.GetNumChildren(), 0)
39+
self.assertEqual(var_f.GetNumChildren(), 0)
40+
self.assertEqual(var_p.GetNumChildren(), 0)
41+
self.assertEqual(var_t.GetNumChildren(), 0)
3842
lldbutil.check_variable(self, var_s, False, "String")
3943
lldbutil.check_variable(self, var_c, False, "@thick a.D.Type")
4044
lldbutil.check_variable(self, var_f, True, '@thick ((Int) -> Int).Type')

0 commit comments

Comments
 (0)