Skip to content
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

In WMO, make sure the dummy "primary" compilation input is a Swift source file #1346

Merged
merged 1 commit into from May 1, 2023

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented May 1, 2023

Otherwise, if the first argument is anything else (e.g. an object file) we will use it as a key and the compiler won't be too happy about that.

Resolves rdar://108741675

…urce file

Otherwise, if the first argument is anything else (e.g. an object file) we will use it as a key and the compiler won't be too happy about that.

Resolves rdar://108741675
@artemcm artemcm requested a review from etcwilde May 1, 2023 18:44
@artemcm
Copy link
Contributor Author

artemcm commented May 1, 2023

@swift-ci test

@@ -585,7 +585,10 @@ extension Driver {
// To match the legacy driver behavior, make sure we add the first input file
// to the output file map if compiling without primary inputs (WMO), even
// if there aren't any corresponding outputs.
entries[inputFiles[0].fileHandle] = [:]
guard let firstSourceInputHandle = inputFiles.first(where:{ $0.type == .swift })?.fileHandle else {
fatalError("Formulating swift-frontend invocation without any input .swift files")
Copy link
Member

Choose a reason for hiding this comment

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

I think I can hit this fatalError, though honestly, if we're even formulating FrontendJobs when we don't have any source inputs, something has probably gone wrong before this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thinking is that, if anything, this will help catch such issues early. This code-path should not otherwise be taken if we don't have any source inputs, I don't think.

Copy link
Member

@etcwilde etcwilde left a comment

Choose a reason for hiding this comment

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

Yep, this combined with #1347 looks good.
Thank you for looking into this.

@artemcm artemcm merged commit 7831d39 into apple:main May 1, 2023
3 checks passed
@artemcm artemcm deleted the OnlySourceForWMOSupplements branch May 1, 2023 23:30
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.

None yet

2 participants