Skip to content

[Frontend] Avoid doing whole-module work under primary-file typecheck #27153

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

jrose-apple
Copy link
Contributor

...a situation we get into with indexing. The way Xcode generates indexing invocations is to take a build command and add additional flags to it; in order for the Driver to produce a single frontend command from that, it currently plans as if it's going to do a whole-module -typecheck and then turns around and uses -primary-file anyway. This is questionable practice, to be sure...

...but meanwhile, let's not crash by trying to access declarations that haven't been type-checked yet.

rdar://problem/53117124

...a situation we get into with indexing. The way Xcode generates
indexing invocations is to take a build command and add additional
flags to it; in order for the Driver to produce a single frontend
command from /that/, it currently plans as if it's going to do a
whole-module -typecheck and then turns around and uses -primary-file
anyway. This is questionable practice, to be sure...

...but meanwhile, let's not crash by trying to access declarations
that haven't been type-checked yet.

rdar://problem/53117124
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@akyrtzi akyrtzi left a comment

Choose a reason for hiding this comment

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

Good catch!

@jrose-apple jrose-apple merged commit 9e6d4db into swiftlang:master Sep 13, 2019
@jrose-apple jrose-apple deleted the i-prefer-two-percent-modules-myself branch September 13, 2019 00:53
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Sep 13, 2019
…swiftlang#27153)

...a situation we get into with indexing. The way Xcode generates
indexing invocations is to take a build command and add additional
flags to it; in order for the Driver to produce a single frontend
command from /that/, it currently plans as if it's going to do a
whole-module -typecheck and then turns around and uses -primary-file
anyway. This is questionable practice, to be sure...

...but meanwhile, let's not crash by trying to access declarations
that haven't been type-checked yet.

rdar://problem/53117124
(cherry picked from commit 9e6d4db)
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Sep 13, 2019
…swiftlang#27153)

...a situation we get into with indexing. The way Xcode generates
indexing invocations is to take a build command and add additional
flags to it; in order for the Driver to produce a single frontend
command from /that/, it currently plans as if it's going to do a
whole-module -typecheck and then turns around and uses -primary-file
anyway. This is questionable practice, to be sure...

...but meanwhile, let's not crash by trying to access declarations
that haven't been type-checked yet.

rdar://problem/53117124
(cherry picked from commit 9e6d4db)
Invocation,
moduleIsPublic)) {
return true;
if (opts.InputsAndOutputs.isWholeModule()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to explain why this test is here in a comment.

@davidungar
Copy link
Contributor

davidungar commented Sep 13, 2019 via email

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