Skip to content

Conversation

medismailben
Copy link

Cherry-pick #1937 & #1978 to swift/next.

beccadax and others added 2 commits October 16, 2020 17:41
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 <medismail.bennani@gmail.com>
@medismailben medismailben merged commit fb28073 into swiftlang:swift/next Oct 16, 2020
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