-
Notifications
You must be signed in to change notification settings - Fork 341
Implemement TypeSystemSwiftTypeRef::GetBitSize() (NFC) #1636
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
Conversation
This is not yet ready, a few tests are still failing. Just trying to get early feedback for swiftlang/swift#33417 |
9996dd0
to
34ec1a3
Compare
ac8941d
to
f26b688
Compare
@kastiglione This is my work-in-progress for the |
c37068b
to
6814c3f
Compare
This is good to go now. |
@swift-ci test |
test with swiftlang/swift#33417 |
1 similar comment
test with swiftlang/swift#33417 |
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 is a first pass of reading and questions, there's a lot here (for me anyway), I'll do a follow up read. Sorry for some minor comments.
@@ -114,6 +134,21 @@ class SwiftLanguageRuntimeImpl { | |||
bool IsABIStable(); | |||
|
|||
protected: | |||
/// Use the reflection context to build a TypeRef object. | |||
/// | |||
///\param module can be used to specify a module to look up DWARF |
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 correct formatting, or will it cause rendering issues?
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.
That's a typo!
lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Outdated
Show resolved
Hide resolved
lldb/source/Target/SwiftLanguageRuntimeDynamicTypeResolution.cpp
Outdated
Show resolved
Hide resolved
return nullptr; | ||
swift::Demangle::NodePointer node = | ||
TypeSystemSwiftTypeRef::GetCanonicalDemangleTree( | ||
module ? module : ts->GetModule(), Dem, mangled_name.GetStringRef()); |
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.
module ? module : ts->GetModule(), Dem, mangled_name.GetStringRef()); | |
module ?: ts->GetModule(), Dem, mangled_name.GetStringRef()); |
// but all the other functions currently get this wrong, too! | ||
m_process.GetTarget().CalculateExecutionContext(exe_ctx); |
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.
am I understanding right that this isn't using frame
, to match other places calling it wrong?
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.
Yes, I made a note in rdar://problem/67587895 Locking the wrong scratch context in most places in SwiftLanguageRuntimeDynamicTypeResolution.cpp to fix this in a separate commit.
|
||
std::string SwiftASTContext::ImportName(const clang::NamedDecl *clang_decl) { | ||
if (auto clang_importer = GetClangImporter()) { | ||
// FIMXE: It's not clear why this special case is necessary. |
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.
Note to self: I forgot about this. I meant to check this before uploading.
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 no longer necessary.
e589cb0
to
4f33869
Compare
test with swiftlang/swift#33417 |
In order to implement GetBitSize, this patch also adds an initial TypeRef-based implementation of SwiftLanguageRuntimeImpl::DoArchetypeBinding(). To make SwiftLanguageRuntimeImpl::GetTypeInfo() work with TypeRefs of ClangImported non-Objective-C types, a new callback is added to swift::reflection::MemoryReader, which allos LLDB to provide the swift::reflection::TypeInfo for a Clang type based on debug information. <rdar://problem/55412920>
The SwiftOptionSet data formatter still reconstructs types after ths patch because there is leftover work in ClangImporter to separate out name importing. <rdar://problem/67709905>
4f33869
to
16bcb30
Compare
test with swiftlang/swift#33417 |
1 similar comment
test with swiftlang/swift#33417 |
test with swiftlang/swift#33417 |
test with swiftlang/swift#33417 |
module that does not have two different implementations that vary based off an opaque #define.
test with swiftlang/swift#33417 |
test with swiftlang/swift#33417 |
test with swiftlang/swift#33417 |
Did this not get picked into master-next? |
… -- adrian
On Sep 10, 2020, at 12:41 PM, Dave Lee ***@***.***> wrote:
Did this not get picked into master-next?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub <#1636 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARFXBOGDBALRC5T2QBUG33SFETVBANCNFSM4P3Z67ZQ>.
|
Do we prefer to push directly instead of using a PR? |
@@ -1587,7 +1643,64 @@ TypeSystemSwiftTypeRef::GetPointerType(opaque_compiler_type_t type) { | |||
llvm::Optional<uint64_t> | |||
TypeSystemSwiftTypeRef::GetBitSize(opaque_compiler_type_t type, | |||
ExecutionContextScope *exe_scope) { | |||
return m_swift_ast_context->GetBitSize(ReconstructType(type), exe_scope); | |||
auto impl = [&]() -> llvm::Optional<uint64_t> { | |||
// Bug-for-bug compatibility. See comment in SwiftASTContext::GetBitSize(). |
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.
How come this implementation is so much different from master-next
? dab2fc6#diff-4f052b540e66838ef123c3a839bacf1cR1617-R1629
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.
For example GetAsClangTypeOrNull
exists in this PR but not in the master-next
version?
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.
Thank you for catching this! I mush have cherry-picked an older version of the commit. Wow.
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.
Hmm.. no. git diff origin/swift/master doesn't show a difference. Is it possible that this is the state of one of the earlier commits in the PR and not the final one?
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.
the reason I noticed this is because when I cherry picked #1779, there were changes to GetAsClangTypeOrNull
that did not exist at all on swift/master-next
.
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 am confused 🤔
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 seems I have done something slightly wrong in my cherry-pick in #1779.
Either way fine — I usually create two PRs so I can merge them at the same time once the testing for the master one has succeeded. This was an exception. |
In order to implement GetBitSize, this patch also adds an initial
TypeRef-based implementation of
SwiftLanguageRuntimeImpl::DoArchetypeBinding(). To make
SwiftLanguageRuntimeImpl::GetTypeInfo() work with TypeRefs of
ClangImported non-Objective-C types, a new callback is added to
swift::reflection::MemoryReader, which allos LLDB to provide the
swift::reflection::TypeInfo for a Clang type based on debug
information.
rdar://problem/55412920
Needs swiftlang/swift#33417