From e336c540e572c811d8402aa5275989c44d1f2e48 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 7 Oct 2025 16:23:45 -0700 Subject: [PATCH] [LLDB] Remove fallback for Builtin.Object rdar://161435435 (cherry picked from commit 79fdafec08aca2c5681b509be5bcc72e2f77bfdc) --- .../Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp | 4 ++++ .../lang/swift/variables/func/TestSwiftFunctionVariables.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp index 8c4db522159b4..36b5f5bc885e5 100644 --- a/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp @@ -1092,6 +1092,10 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional visit_only, // Try the instance type metadata. if (!m_valobj) { + // Static builtin types have no children. + if (ts.IsBuiltinType(m_type)) + return 0; + LLDBTypeInfoProvider tip(m_runtime, ts); auto cti_or_err = reflection_ctx->GetClassInstanceTypeInfo( *tr, &tip, ts.GetDescriptorFinder()); diff --git a/lldb/test/API/lang/swift/variables/func/TestSwiftFunctionVariables.py b/lldb/test/API/lang/swift/variables/func/TestSwiftFunctionVariables.py index c04d46f6e7fee..5af2c38405166 100644 --- a/lldb/test/API/lang/swift/variables/func/TestSwiftFunctionVariables.py +++ b/lldb/test/API/lang/swift/variables/func/TestSwiftFunctionVariables.py @@ -32,6 +32,8 @@ def test_function_variables(self): # Get the function pointer variable from our frame func_ptr_value = self.frame().FindVariable('func_ptr') self.assertEqual(func_ptr_value.GetNumChildren(), 2) + self.assertEqual(func_ptr_value.GetChildAtIndex(0).GetNumChildren(), 0) + self.assertEqual(func_ptr_value.GetChildAtIndex(1).GetNumChildren(), 0) # Grab the function pointer value as an unsigned load address func_ptr_addr = func_ptr_value.GetValueAsUnsigned() @@ -46,4 +48,3 @@ def test_function_variables(self): # Make sure the function pointer correctly resolved to our a.bar # function self.assertEqual('a.bar() -> ()', func_ptr_function.name) -