forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb/Swift] Fix import attributes handing in following expression evaluation #1978
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci test |
lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp
Outdated
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp
Outdated
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp
Outdated
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp
Outdated
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp
Outdated
Show resolved
Hide resolved
This LGTM with mine an Jonas' comments addressed. Please don't forget to cherry-pick to swift/next! |
0a50c6b
to
a9bd280
Compare
@swift-ci test |
lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp
Outdated
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftPersistentExpressionState.h
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftPersistentExpressionState.h
Outdated
Show resolved
Hide resolved
lldb/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp
Outdated
Show resolved
Hide resolved
02b6cc3
to
32faa56
Compare
@swift-ci test and merge |
JDevlieghere
approved these changes
Oct 16, 2020
kastiglione
approved these changes
Oct 16, 2020
32faa56
to
b2138b0
Compare
Previously, when importing a Swift module it the REPL or a Playground, LLDB would only cache the module name and reload the module at every expression evaluation. Doing so means that, when LLDB transfers imports information from the original source file to the new one, it is doing it with low fidelity, because LLDB would not keep track of the import attributes used in the previous expression evaluations. Thanks to swiftlang/swift#33935, we can now cache the whole `swift::AttributedImport<swift::ImportedModule>>` instead of only storing the module name. This struct contains both the `ImportedModule` with the `ModuleDecl` but also the `ImportOptions` set containing all the possible import attributes (Exported / Testable / PrivateImport ...) of that import statement. Now, before compiling and evaluating a Swift expression, LLDB fetches all the attributed imports cached previously and add them to the `ImplicitImportInfo` object that is used to create the `ModuleDecl` of the evaluated expression. It allows for the `ImportOptions` to be propagated in the compiled expression. This should fix some irregularities between the debugger and the compiler regarding import statements. rdar://65319954 Signed-off-by: Med Ismail Bennani <[email protected]>
b2138b0
to
d26ebfd
Compare
@swift-ci test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, when importing a Swift module it the REPL or a Playground, LLDB
would only cache the module name and reload the module at every expression
evaluation. Doing so means that, when LLDB transfers imports information from
the original source file to the new one, it is doing it with low fidelity,
because LLDB would not keep track of the import attributes used in the previous
expression evaluations.
Thanks to swiftlang/swift#33935, we can now cache the whole
swift::AttributedImport<swift::ImportedModule>>
instead of only storing themodule name. This struct contains both the
ImportedModule
with theModuleDecl
but also the
ImportOptions
set containing all the possible import attributes(Exported / Testable / PrivateImport ...) of that import statement.
Now, before compiling and evaluating a Swift expression, LLDB fetches all the
attributed imports cached previously and add them to the
ImplicitImportInfo
object that is used to create the
ModuleDecl
of the evaluated expression.It allows for the
ImportOptions
to be propagated in the compiled expression.This should fix some irregularities between the debugger and the
compiler regarding import statements.
rdar://65319954
Signed-off-by: Med Ismail Bennani [email protected]