Skip to content

[lldb] Introduce an ImportedDeclaration and [lldb] Handle @_originallyDefinedIn #9657

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

augusto2112
Copy link

This PR contains two commits:

[lldb] Introduce an ImportedDeclaration

Introduce a debug info independent type, ImportedDeclaration, which is
analogous to DWARF's DW_AT_imported_declaration, as well as a way to
search them by name.


[lldb] Handle @_originallyDefinedIn

Types annotated with @_originallyDefinedIn don't live in the module
listed in their mangled name. To account for this, the compiler emits a
DW_TAG_imported_declaration for those types under the name of the
swiftmodule these types can be found at. This patch implements the logic
required to produce the mangled name that can be used in type
reconstruction to successfully find these types.

rdar://137146961

@augusto2112
Copy link
Author

swiftlang/swift#77779
@swift-ci test

@augusto2112
Copy link
Author

swiftlang/swift#77779
@swift-ci test

Introduce a debug info independent type, ImportedDeclaration, which is
analogous to DWARF's DW_AT_imported_declaration, as well as a way to
search them by name.
@augusto2112
Copy link
Author

swiftlang/swift#77779
@swift-ci test

Types annotated with @_originallyDefinedIn don't live in the module
listed in their mangled name. To account for this, the compiler emits a
DW_TAG_imported_declaration for those types under the name of the
swiftmodule these types can be found at. This patch implements the logic
required to produce the mangled name that can be used in type
reconstruction to successfully find these types.

rdar://137146961
@augusto2112 augusto2112 force-pushed the orig-def-in-imported-decl-6 branch from 47f104b to b9f47ba Compare December 3, 2024 20:47
@augusto2112 augusto2112 requested a review from a team as a code owner December 3, 2024 20:47
@augusto2112
Copy link
Author

swiftlang/swift#77779
@swift-ci test

/// \param[in] find_one
/// If set to true, the search will stop after the first imported
/// declaration is found.
void FindImportedDeclarations(ConstString name,

Choose a reason for hiding this comment

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

This API should probably exist upstream, too.

/// If set to true, the search will stop after the first imported
/// declaration is found.
void FindImportedDeclarations(ConstString name,
std::vector<ImportedDeclaration> &results,

Choose a reason for hiding this comment

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

Unless you need to append to the same vector multiple times, it should probably be a return type.

Copy link
Author

Choose a reason for hiding this comment

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

You do append to the vector multiple times as part of the implementation (for example on SymbolFileDWARFDebugMap). This is also how all of the other query APIs in Module and SymbolFile do it, so I'd rather keep it this way to stay consistent.

@@ -0,0 +1,18 @@
//===-- Symbol.cpp --------------------------------------------------------===//

Choose a reason for hiding this comment

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

update comment

@augusto2112
Copy link
Author

Closed in favor of #9745

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