Skip to content

Commit 0b8e8f4

Browse files
authoredMar 8, 2025
Merge pull request #79831 from Steelskin/fabrice/update-compiler-stl-version-mismatch
Update compiler/STL version mismatch condition
2 parents 17e3054 + 4fd65dd commit 0b8e8f4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
 

‎SwiftCompilerSources/CMakeLists.txt

+10-4
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,16 @@ function(add_swift_compiler_modules_library name)
184184
# https://github.com/apple/swift/issues/73254
185185
list(APPEND swift_compile_options "-Xllvm" "-sil-disable-pass=loadable-address")
186186

187-
# The STL in VS 17.10 requires Clang 17 or higher, but bootstrapping generally uses toolchains with older versions
188-
# versions of Clang. Swift 6 toolchains are the first to include Clang 17, so if we are on Windows and using an
189-
# earlier toolchain, we need to relax to relax this requirement with ALLOW_COMPILER_AND_STL_VERSION_MISMATCH.
190-
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0)
187+
# MSVC 14.40 (VS 17.10, MSVC_VERSION 1940) added a requirement for Clang 17 or higher.
188+
# Swift 6.0 is the first version to include Clang 17.
189+
# MSVC 14.43 (VS 17.13, MSVC_VERSION 1943) added a requirement for Clang 18 or higher.
190+
# Swift 6.1 is the first version to include Clang 18.
191+
# These requirements can be found in `include/yvals_core.h` in the MSVC headers.
192+
# Bootstrapping generally uses toolchains with older versions of Clang, so if we are on Windows
193+
# and using an earlier toolchain, we need to relax this requirement by setting
194+
# `_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH`.
195+
if((CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0 AND MSVC_VERSION VERSION_GREATER_EQUAL 1940) OR
196+
(CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.1 AND MSVC_VERSION VERSION_GREATER_EQUAL 1943))
191197
list(APPEND swift_compile_options "-Xcc" "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH")
192198
endif()
193199

0 commit comments

Comments
 (0)