Skip to content

Commit 2edd040

Browse files
Merge pull request #10808 from adrian-prantl/151330021
[lldb] Support counting the children of metatypes using reflection me…
2 parents cf673fb + a0b203a commit 2edd040

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
@@ -1381,7 +1381,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
13811381
// consider handling them here, but
13821382
// TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex can also
13831383
// handle them and without a Process.
1384-
if (!TypeSystemSwiftTypeRef::IsBuiltinType(m_type)) {
1384+
if (!TypeSystemSwiftTypeRef::IsBuiltinType(m_type) &&
1385+
!Flags(m_type.GetTypeInfo()).AnySet(eTypeIsMetatype)) {
13851386
LLDB_LOG(GetLog(LLDBLog::Types),
13861387
"{0}: unrecognized builtin type info or this is a Clang type "
13871388
"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)