-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Change the type alias resolution algorithm #10036
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] Change the type alias resolution algorithm #10036
Conversation
227dceb
to
d220d9d
Compare
@swift-ci test |
d220d9d
to
8d29597
Compare
default: | ||
break; | ||
default: { | ||
llvm::SmallVector<NodePointer, 2> children; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code meant to both be here and in GetCanonicalNode
?
@@ -514,12 +522,6 @@ class TypeSystemSwiftTypeRef : public TypeSystemSwift { | |||
CompilerType LookupClangForwardType(llvm::StringRef name, | |||
llvm::ArrayRef<CompilerContext> decl_context); | |||
|
|||
/// Recursively resolves all type aliases. | |||
swift::Demangle::NodePointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResolveAllTypeAliases is gone from the header but not implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It never existed!
return TypeSystemSwiftTypeRef::Transform(dem, node, [&](NodePointer node) { | ||
return Canonicalize(dem, node, flavor); | ||
}); | ||
NodePointer transformed = Canonicalize(dem, node, flavor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this block of code be in a separate function called TransformPreOrder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only a single use, and it has shortcut in that it won't traverse the children of a transformed node, which is something a generic preorder transform maybe shouldn't do, so I decided to punt on that until we have a second use-case.
/// Desugar to this node and if it is a type alias resolve it by | ||
/// looking up its type in the debug info. | ||
swift::Demangle::NodePointer | ||
Canonicalize(swift::Demangle::Demangler &dem, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these functions moved to be public? I don't see you using them anywhere outside TypeSystemSwiftTypeRef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
8d29597
to
edfc421
Compare
from a post-oder to a pre-order traversal. This is necessary to resolve generic type aliases that bind other type aliases in one go, instead of first resolving the bound type aliases. Debug Info will have a record for `SomeAlias<SomeOtherAlias>` but not `SomeAlias<WhatSomeOtherAliasResolvesTo>` because it tries to preserve all sugar. rdar://144884987
edfc421
to
b16a454
Compare
@swift-ci test |
@swift-ci test |
from a post-oder to a pre-order traversal. This is necessary to resolve generic type aliases that bind other type aliases in one go, instead of first resolving the bound type aliases. Debug Info will have a record for
SomeAlias<SomeOtherAlias>
but notSomeAlias<WhatSomeOtherAliasResolvesTo>
because it tries to preserve all sugar.rdar://144884987