Skip to content

[Option] Add a feature flag for -Isystem #81964

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

ian-twilightcoder
Copy link
Contributor

swift-build needs a flag to know if -Isystem is available.

rdar://152540225

swift-build needs a flag to know if -Isystem is available.

rdar://152540225
Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

Can you just check on swift driver side for if a frontend flag is available? Or is this more involved?

@ian-twilightcoder
Copy link
Contributor Author

Can you just check on swift driver side for if a frontend flag is available? Or is this more involved?

I don't think so, swift-build uses the current version of swift-driver that knows about Isystem, but it uses an old version of swift-frontend that doesn't know about it.

@ian-twilightcoder
Copy link
Contributor Author

Related to swiftlang/swift-build#553

@ian-twilightcoder
Copy link
Contributor Author

@swift-ci smoke test

@ian-twilightcoder ian-twilightcoder merged commit 3114657 into swiftlang:main Jun 4, 2025
3 checks passed
@cachemeifyoucan
Copy link
Contributor

cachemeifyoucan commented Jun 4, 2025

Merged?

What are you going to do on build system side if flag is not available? Pass as "-F" instead? You can eat the unsupported flag in swift driver and pass it as something else. I don't like a small thing like a flag available is listed as feature and we need to teach build system about it but I don't exactly know what you want to do. This implementation is also fine so no need to revert.

@ian-twilightcoder
Copy link
Contributor Author

ian-twilightcoder commented Jun 4, 2025

Merged?

I enabled auto-merge and it merged with no approvals. 🤦‍♂️

What are you going to do on build system side if flag is not available? Pass as "-F" instead? You can eat the unsupported flag in swift driver and pass it as something else. I don't like a small thing like a flag available is listed as feature and we need to teach build system about it but I don't exactly know what you want to do. This implementation is also fine so no need to revert.

No, pass as -I. swiftlang/swift-build#553 This approach was the one suggested by the swift-build team. I didn't see anything in the driver that knows about what flags are available in the front end, my first instinct was for swift-build to use the driver to query the front end but there doesn't seem to be such a thing.

@artemcm
Copy link
Contributor

artemcm commented Jun 4, 2025

I didn't see anything in the driver that knows about what flags are available in the front end, my first instinct was for swift-build to use the driver to query the front end but there doesn't seem to be such a thing.

The driver queries the toolchain's compiler at the beginning of planning to get supported flags. And then throughout the driver code we use:

if isFrontendArgSupported(.<someFlag>) {
   // Specify this flag to the actual job command
}

And swift-build, similarly, can query which flags its driver supports.

@ian-twilightcoder
Copy link
Contributor Author

I didn't see anything in the driver that knows about what flags are available in the front end, my first instinct was for swift-build to use the driver to query the front end but there doesn't seem to be such a thing.

The driver queries the toolchain's compiler at the beginning of planning to get supported flags. And then throughout the driver code we use:

if isFrontendArgSupported(.<someFlag>) {
   // Specify this flag to the actual job command
}

And swift-build, similarly, can query which flags its driver supports.

Iiinteresting. That's awkward to hook up in SwiftCompilerSpec since that doesn't have a Driver, but I like the idea of swapping the flag in the driver and then we don't need this feature flag. Let me see if I can get that going today and then revert this and the swift-build adoption too.

@ian-twilightcoder
Copy link
Contributor Author

ian-twilightcoder commented Jun 4, 2025

I didn't see anything in the driver that knows about what flags are available in the front end, my first instinct was for swift-build to use the driver to query the front end but there doesn't seem to be such a thing.

The driver queries the toolchain's compiler at the beginning of planning to get supported flags. And then throughout the driver code we use:

if isFrontendArgSupported(.<someFlag>) {
   // Specify this flag to the actual job command
}

And swift-build, similarly, can query which flags its driver supports.

Iiinteresting. That's awkward to hook up in SwiftCompilerSpec since that doesn't have a Driver, but I like the idea of swapping the flag in the driver and then we don't need this feature flag. Let me see if I can get that going today and then revert this and the swift-build adoption too.

Although... If SWIFT_USE_INTEGRATED_DRIVER is set to NO then I guess swift-build needs to look at the features directly. So maybe we do need this feature flag after all.

@ian-twilightcoder ian-twilightcoder deleted the Isystem-feature-flag branch June 5, 2025 00:10
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