-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Add Foundation._NSSwiftTimeZone support #7074
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] Add Foundation._NSSwiftTimeZone support #7074
Conversation
3b74abb
to
cd909e9
Compare
lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0); | ||
|
||
if (!valobj_addr) | ||
return false; | ||
|
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.
unused code.
@swift-ci test |
This depends on #7073. See 89b7e0f90f3829673662e6d7a20a0ec747f936d0 for the changes unique to this PR. |
@swift-ci test windows |
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
Outdated
Show resolved
Hide resolved
cd909e9
to
89b7e0f
Compare
@swift-ci test |
@swift-ci test windows |
89b7e0f
to
4d1fa0a
Compare
@swift-ci test |
@swift-ci test windows |
@swift-ci test |
Classes implemented in Swift can be exposed to ObjC. For those classes, the ObjC metadata is incomplete. Specifically, the encoded types of the ivars are incomplete. As one might expect, the Swift metadata _is_ complete. In such cases, the Swift runtime should be consulted when determining the dynamic type of a value. Differential Revision: https://reviews.llvm.org/D152837
5848a98
to
2168802
Compare
@swift-ci test |
@swift-ci test windows |
2168802
to
6875ce8
Compare
@swift-ci test |
@swift-ci test windows |
1 similar comment
@swift-ci test windows |
}; | ||
|
||
std::optional<SwiftNominalType> GetSwiftClass(ValueObject &valobj, | ||
AppleObjCRuntime &objc_runtime) { |
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 might be one ore two opportunities for comments in this function to explain the algorithm :-)
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.
done
return {}; | ||
|
||
swift::Demangle::Context ctx; | ||
auto *global = ctx.demangleSymbolAsNode(*swift_symbol); |
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.
No need to do this right away — but for readability this could be a helper in SwiftDemangle.h?
if (auto maybe_swift_class = GetSwiftClass(in_value, *objc_runtime)) { | ||
swift_class = *maybe_swift_class; | ||
std::string type_name = | ||
(llvm::Twine(swift_class.module) + "." + swift_class.identifier).str(); |
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 shorter?
llvm::raw_string_ostream(type_name)<<swift_class.module<<"."<<swift_class.identifier;
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.
unfortunately it's not
std::string remangled; | ||
{ | ||
// Create a mangle tree for __C.dyn_name?. | ||
// Create a mangle tree for Swift.Optional<$module.$class> |
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.
This could also be a few helper functions (in a follow-up commit).
@swift-ci test windows |
6875ce8
to
42c2556
Compare
@swift-ci test |
@swift-ci test windows |
`_NSSwiftTimeZone` is the new Swift implementation of `NSTimeZone`.
42c2556
to
666003e
Compare
@swift-ci test |
@swift-ci test windows |
_NSSwiftTimeZone
is the new Swift implementation ofNSTimeZone
.This is tested by
TestDataFormatterObjCNSDate.py
, where the NSTimeZone summary string tests if run on macOS Sonoma, but with this change they pass.See #7073 for the infrastructure changes that this depends on.
rdar://108478831