-
Notifications
You must be signed in to change notification settings - Fork 344
[lldb] SwiftLanguageRuntime: Support Clang typedef-to-enums. #10392
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] SwiftLanguageRuntime: Support Clang typedef-to-enums. #10392
Conversation
This also relaxes the check for the name of the member in GetIndexOfChildMemberWithName for Clang enums, since the result is always 1 anyway. rdar://147905814
@swift-ci test |
@@ -695,6 +695,15 @@ void LogUnimplementedTypeKind(const char *function, CompilerType type) { | |||
#endif | |||
} | |||
|
|||
CompilerType GetCanonicalClangType(CompilerType type) { | |||
for (unsigned i = 0; i < 32; ++i) { |
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 32? Is this just an arbitrary limit? If so I'd raise it to 1024 or something like that...
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's an arbitrary limit to guard against cycles.
It's for chains of typedefs, so practically I wouldn't expect more than two to ever appear, but I'm fine with dialing up the limit a bit.
@@ -695,6 +695,15 @@ void LogUnimplementedTypeKind(const char *function, CompilerType type) { | |||
#endif | |||
} | |||
|
|||
CompilerType GetCanonicalClangType(CompilerType type) { |
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 is this called CanonicalClangType? There doesn't seem to be anything specific about clang in this function.
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.
I guess this would only be a canonical type if it's a clang type, since untypedefing wouldn't necessarily result in a canonical Swift type, right? Maybe add an assert or early return if this isn't a clang type?
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.
You're right, the function itself is generic, but I wanted to differentiate it from TypeSystemSwiftTypeRef::GetCanonicalNode, which also resolves arbitrarily deep nested Swift type aliases.
I like the idea of asserting that it's a clang type.
@swift-ci test macos |
I'll address the feedback in a follow-up commit. |
This also relaxes the check for the name of the member in
GetIndexOfChildMemberWithName for Clang enums, since the result is
always 1 anyway.
rdar://147905814