Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4e646d190c3faf19195be9e2532318526865044b
      
https://github.com/WebKit/WebKit/commit/4e646d190c3faf19195be9e2532318526865044b
  Author: Ian Grunert <[email protected]>
  Date:   2026-08-26 (Wed, 26 Aug 2026)

  Changed paths:
    M Source/WTF/Scripts/generate-platform-args
    M Source/WebKit/CMakeLists.txt
    M Source/WebKit/PlatformWin.cmake
    A Source/WebKit/Scripts/generate-msvc-stl-modulemap.py
    M Source/cmake/WebKitMacros.cmake

  Log Message:
  -----------
  Fix the Swift clang importer on Windows: MSVC STL module visibility and more
https://bugs.webkit.org/show_bug.cgi?id=322271

Reviewed by Ian Grunert and Elliott Williams.

The Windows Swift build failed in the clang importer for several stacked
reasons:

1. The Swift SDK's vcruntime.modulemap wraps the MSVC STL in a clang
   module whose yvals_core.h lives in an explicit submodule, so the
   __cpp_lib_* feature-test macros never become visible to headers that
   reach <version> through a module import. WTF/simdutf then mix
   pre-C++20 and C++23 preprocessor paths. Seed the macros through the
   platform-swift-args.resp response file (generate-platform-args
   --stl-feature-macros); they must not go on the command line, which
   already sits near the 32767-char CreateProcess limit that ninja hits
   before swiftc-wrapper can expand its own response file.

2. The same modulemap names only two of the STL's __msvc_*.hpp internal
   headers, leaving e.g. std::views::transform (__msvc_ranges_to.hpp)
   invisible at use sites. Generate an amended modulemap listing all of
   them and mount it over the MSVC include dir with a VFS overlay.

Alternatives considered:

1. Generate the amened modulemap directly in cmake rather than python.
   This was more concise but was unusually complex cmake code.

2. Do not _generate_ an amended modulemap; instead ship a static one.
   However, the SDK-provided VC modulemap is currently 796 lines which
   would be troublesome to maintain if we forked. A live amendment
   to insert the extra files seems less bad. (Licensing might also
   have made this awkward.)

3. Instead of execute_process, use a add_custom_command such that the
   python script runs in parallel with other build steps instead of
   at each configure time. Architecturally nicer, but the extra
   dependency edges, plus the need to respect CONFIGURE_DEPENDS
   would have made this even more verbose (and it's only one of
   hundreds of existing python invocations during cmake configure.)

4. List the headers which need to be added, instead of globbing.
   Everyone knows globbing is fragile and bad. However, the list
   of headers may also be fragile, and hopefully the use of
   CONFIGURE_DEPENDS reduces the globbing risk by prompting
   regeneration if the VC runtime header file set changes.

The reference for the limitations of the shipping modulemap is
rdar://185507163.

Co-Authored-By: Adrian Taylor <[email protected]>
Canonical link: https://commits.webkit.org/319854@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to