Skip to content

Align Clang resource directory lookup with Clang driver logic #1895

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

Conversation

kateinoigakukun
Copy link
Member

Previously, we used Triple.platformName(conflatingDarwin: true) to derive the OS directory under /lib/, which was documented as “the name clang uses”. However, this was in fact closer to what Swift itself uses for resource directories, and it diverged from Clang’s behavior in some cases.

For example, for wasm32-unknown-wasip1-threads, Swift uses "wasi" as the OS name, but Clang uses "wasip1", matching the result of Triple::getOS, in their resource directory lookup.

This patch aligns the behavior with Clang’s logic for looking up the compiler resource directory libraries.

Previously, we used `Triple.platformName(conflatingDarwin: true)` to
derive the OS directory under <ResourceDir>/lib/, which was documented
as “the name clang uses”. However, this was in fact closer to what
Swift itself uses for resource directories, and it diverged from
Clang’s behavior in some cases.

For example, for wasm32-unknown-wasip1-threads, Swift uses "wasi" as the
OS name, but Clang uses "wasip1", matching the result of Triple::getOS,
in their resource directory lookup.

This patch aligns the behavior with Clang’s logic for looking up the
compiler resource directory libraries.
@kateinoigakukun
Copy link
Member Author

@swift-ci test

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

Thank you!

@kateinoigakukun kateinoigakukun merged commit b1ab708 into swiftlang:main May 13, 2025
3 checks passed
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.

2 participants