Skip to content

Conversation

@egorzhdan
Copy link
Contributor

This fixes modularization errors that arise when importing a C++ header that contains #include <guiddef.h>, which might hijack this header from the WinSDK module where it belongs.

@egorzhdan egorzhdan requested a review from compnerd August 26, 2025 11:04
@egorzhdan egorzhdan requested a review from a team as a code owner August 26, 2025 11:04
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

Ugh, looks like this header is under /shared and not /um.

@compnerd
Copy link
Member

Yeah, the GUID definition is shared between um and km. We currently get it through transitive includes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we still support older SDKs? This might be a bit simpler if we don't.

Copy link
Member

@compnerd compnerd Aug 28, 2025

Choose a reason for hiding this comment

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

Yes, we do support older SDKs, which is why this gets tricky, but only from 10.0.17763 (Windows 10 RS5).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, so we should be able to remove this check then.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should rename this to winsdk_um.modulemap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds reasonable! Renamed it.

This fixes modularization errors that arise when importing a C++ header that contains `#include <guiddef.h>`, which might hijack this header from the WinSDK module where it belongs.
egorzhdan added a commit to swiftlang/swift-installer-scripts that referenced this pull request Aug 29, 2025
@egorzhdan
Copy link
Contributor Author

swiftlang/swift-installer-scripts#458

@swift-ci please test Windows

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test macOS

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test Linux

@egorzhdan
Copy link
Contributor Author

swiftlang/swift-installer-scripts#458

@swift-ci please build toolchain Windows ARM64

@grynspan grynspan added the Windows Platform: Windows label Sep 2, 2025
@egorzhdan
Copy link
Contributor Author

swiftlang/swift-installer-scripts#458

@swift-ci please build toolchain Windows

@egorzhdan
Copy link
Contributor Author

The toolchain seems to work for me locally – @compnerd would you be OK with landing this?

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

Builds, works. I think that it's a bit unfortunate that we have to split it up, but so be it.

Thanks for doing this!

@egorzhdan egorzhdan merged commit 6f0ab5d into swiftlang:main Sep 9, 2025
4 of 5 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/guiddef branch September 9, 2025 15:24
grynspan added a commit that referenced this pull request Sep 23, 2025
This PR changes the name of the clang module introduced in #83914 from `_GUID`
to `_GUIDDef`. This change is necessary because the Windows SDK declares a type
named `_GUID` and Swift gets confused when a module and a type have the same
name.

This confusion is the motivation for [SE-0491](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0491-module-selectors.md),
but we can't just wait for a fix because the new module is a source-breaking
change and clients won't be able to adopt the proposed syntax for some time.
grynspan added a commit that referenced this pull request Sep 24, 2025
This PR changes the name of the clang module introduced in #83914 from
`_GUID` to `_GUIDDef`. This change is necessary because the Windows SDK
declares a type named `_GUID` and Swift gets confused when a module and
a type have the same name.

This confusion is the motivation for
[SE-0491](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0491-module-selectors.md),
but we can't just wait for a fix because the new module is a
source-breaking change and clients won't be able to adopt the proposed
syntax for some time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Windows Platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants