Skip to content

Don't create a Module SwiftASTContext when the stdlib is missing #1395

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
merged 1 commit into from
Jun 30, 2020

Conversation

vedantk
Copy link

@vedantk vedantk commented Jun 30, 2020

A Module SwiftASTContext that cannot access the stdlib module will crash
when performing simple actions, like looking up a type.

This patch tries to make the Target/Module overrides of CreateInstance
look more like each other, w.r.t error handling in particular.

rdar://57695158, rdar://64828733
(cherry picked from commit 21acf0e)

A Module SwiftASTContext that cannot access the stdlib module will crash
when performing simple actions, like looking up a type.

This patch tries to make the Target/Module overrides of CreateInstance
look more like each other, w.r.t error handling in particular.

rdar://57695158, rdar://64828733
(cherry picked from commit 21acf0e)
@vedantk
Copy link
Author

vedantk commented Jun 30, 2020

PR for master: #1391. (master-next has the stylistic changes Adrian requested.)

@fredriss
Copy link

@swift-ci test

@fredriss
Copy link

Do we know what can lead to this kind of situation in the first place?

@vedantk
Copy link
Author

vedantk commented Jun 30, 2020

Do we know what can lead to this kind of situation in the first place?

There's two situations I know of. One is the case where the program doesn't link in the stdlib. The other is when there's a version mismatch between the debugger and the compiler, like: Cannot load Swift type information; AST validation error in "[redacted]": The module file format is too new to be used by this version of the debugger. Cannot create Swift scratch context (couldn't load the Swift stdlib). In the latter case at least (not sure about the former), when we fail to create a scratch AST context, we try to create a fallback Module AST context, and this can accidentally succeed even if the stdlib is missing. A missing stdlib is an error when constructing the scratch context.

@vedantk vedantk merged commit ba37712 into swiftlang:swift/release/5.3 Jun 30, 2020
@vedantk vedantk deleted the eng/PR-57695158 branch June 30, 2020 17:04
@adrian-prantl
Copy link

Thanks!

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.

3 participants