Skip to content

Conversation

@adrian-prantl
Copy link

This is done by defering to the Objective-C runtime. This functionality is implemented in the visitor because ObjC object typerefs are fully valid reference types in the Swift reflection descriptors already and only LLDB wants to look inside them.

rdar://154450536

@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl
Copy link
Author

Updated the test, the previous one didn't actually exercise the new code m-(

@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl changed the title [LLDB] Add ObjC object typeref support to SwiftRuntimeTypeVisitor [DRAFT] [LLDB] Add ObjC object typeref support to SwiftRuntimeTypeVisitor Dec 4, 2025
This patch moves the disjunct implementations for
TypeSystemTypeRef::GetNumFields and GetIndexOfChildMemberWithName into
the TypeRef visitor, so they behave consistently.

rdar://154450536

ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
if (is_imported && type.GetNumFields(&exe_ctx) == 0)
CompilerType clang_type;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move this to under the early return

type.GetTypeSystem().dyn_cast_or_null<TypeSystemSwift>();
if (ts &&
ts->IsImportedType(type.GetOpaqueQualType(), &clang_type))
is_imported = true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!ts)
  return false

CompilerType clang_type;
bool is_imported = ts->IsImportedType(type.GetOpaqueQualType(), &clang_type);

g_formatters.push_back(
[](lldb_private::ValueObject &valobj, lldb::DynamicValueType dyn_type,
FormatManager &format_manager) -> lldb::SyntheticChildrenSP {
struct IsEligible {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't your code, but it's hard to understand what "IsEligible" is checking for. Could you comment this function, either on top or inside it explaining what the eligibility criteria are?

Also, this structure with static function could be replaced by a lambda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants