Skip to content

Commit 4fd65dd

Browse files
committed
Be more explicit in MSVC and Clang version mapping
1 parent a8346a8 commit 4fd65dd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +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-
# MSVC 14.43 requires Clang 18 or higher, which is currently not available in any Swift toolchain.
191-
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0 OR MSVC_VERSION VERSION_GREATER_EQUAL 1943)
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))
192197
list(APPEND swift_compile_options "-Xcc" "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH")
193198
endif()
194199

0 commit comments

Comments
 (0)