Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb] Adjust module name for types with @_originallyDefinedIn #9401

Open
wants to merge 1 commit into
base: stable/20240723
Choose a base branch
from

Conversation

augusto2112
Copy link

The compiler generates types with @_originallyDefinedIn as a child of the original module, but with the ABI module in the mangled name. Before looking up types in reflection metadata, adjust the type's mangled name to use the original module name, since that's what's stored in reflection metadata.

rdar://137146961

The compiler generates types with @_originallyDefinedIn as a child of
the original module, but with the ABI module in the mangled name. Before
looking up types in reflection metadata, adjust the type's mangled name
to use the original module name, since that's what's stored in
reflection metadata.

rdar://137146961
@augusto2112
Copy link
Author

swiftlang/swift#76924
@swift-ci test

Comment on lines +3029 to +3034
// Find the type's module node.
while (child && child->getKind() != Node::Kind::Module &&
child->hasChildren()) {
parent = child;
child = child->getFirstChild();
}

Choose a reason for hiding this comment

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

what about a concrete generic type, would its type parameters need to have their modules replaced?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah you're right, this won't work if the type parameters are annotated with originallyDefinedIn

ts->GetTypeSystemSwiftTypeRef().GetCachedType(type.GetMangledTypeName());

if (!lldb_type) {
LLDB_LOGV(GetLog(LLDBLog::Types),

Choose a reason for hiding this comment

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

this log is verbose but the following ones are not. Should this be non-verbose?

let a = A()
let b = Alias()
let d = C.D()
let e = E<Prop>.t(Prop())

Choose a reason for hiding this comment

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

re my comment about concrete generic types, could you add one ore more generic variables? Ex:

let f: A? = A()
let g = [A()]
let h: E<A> .t(A())

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