Skip to content

[ABIChecking] Use -Isystem and -Fsystem for swift-api-digester #1933

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Sources/SwiftDriver/Jobs/APIDigesterJobs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,8 @@ extension Driver {
commandLine.appendFlag(.resourceDir)
commandLine.appendPath(VirtualPath.lookup(frontendTargetInfo.runtimeResourcePath.path))

try commandLine.appendAll(.I, from: &parsedOptions)
for systemImport in parsedOptions.arguments(for: .Isystem) {
commandLine.appendFlag(.I)
commandLine.appendFlag(systemImport.argument.asSingle)
}
try commandLine.appendAll(.F, from: &parsedOptions)
for systemFramework in parsedOptions.arguments(for: .Fsystem) {
commandLine.appendFlag(.iframework)
commandLine.appendFlag(systemFramework.argument.asSingle)
}
try commandLine.appendAll(.I, .Isystem, from: &parsedOptions)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, we do not have a way to test whether the selected toolchain's swift-api-digester supports this as a SwiftAPIDigesterOption. Since the flag itself is not new to the compiler, what happens when this gets passed to a swift-api-digester which predates swiftlang/swift#82283?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prior to swiftlang/swift#82283 the argument will just be lost because the digester won't try to read -Isystem or -Fsystem. There's nothing in swiftscan that I can see to get api-digester args. The strings it returns from swiftscan_compiler_supported_arguments_query don't include the flags like SwiftAPIDigesterOption. And swift-api-digester doesn't support -emit-supported-features either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW though, swift-build doesn't currently use -iframework, -Fsystem, or -Isystem when it makes digester jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

swiftpm also doesn't use -iframework in its digester jobs, as far as I can tell.

try commandLine.appendAll(.F, .Fsystem, from: &parsedOptions)

try commandLine.appendLast(.swiftVersion, from: &parsedOptions)
}
Expand Down