@@ -152,6 +152,7 @@ if ($PinnedBuild -eq "") {
152152 " AMD64" {
153153 $PinnedBuild = " https://download.swift.org/swift-5.10.1-release/windows10/swift-5.10.1-RELEASE/swift-5.10.1-RELEASE-windows10.exe"
154154 $PinnedSHA256 = " 3027762138ACFA1BBE3050FF6613BBE754332E84C9EFA5C23984646009297286"
155+ $PinnedVersion = " 5.10.1"
155156 }
156157 " ARM64" {
157158 # TODO(hjyamauchi) once we have an arm64 release, fill in PinnedBuild and PinnedSHA256.
@@ -739,6 +740,13 @@ function Get-PinnedToolchainRuntime() {
739740 return " $BinaryCache \toolchains\${PinnedToolchain} \PFiles64\Swift\runtime-development\usr\bin"
740741}
741742
743+ function Get-PinnedToolchainVersion () {
744+ if (Test-Path variable:PinnedVersion) {
745+ return $PinnedVersion
746+ }
747+ return " 5.10.1"
748+ }
749+
742750function TryAdd-KeyValue ([hashtable ]$Hashtable , [string ]$Key , [string ]$Value ) {
743751 if (-not $Hashtable.Contains ($Key )) {
744752 $Hashtable.Add ($Key , $Value )
@@ -1311,6 +1319,14 @@ function Build-Compilers() {
13111319 }
13121320 }
13131321
1322+ # The STL in VS 17.10 requires Clang 17 or higher, but Swift toolchains prior to version 6 include older versions
1323+ # of Clang. If bootstrapping with an older toolchain, we need to relax to relax this requirement with
1324+ # ALLOW_COMPILER_AND_STL_VERSION_MISMATCH.
1325+ $SwiftFlags = @ ();
1326+ if ([System.Version ](Get-PinnedToolchainVersion ) -lt [System.Version ]" 6.0" ) {
1327+ $SwiftFlags += @ (" -Xcc" , " -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" );
1328+ }
1329+
13141330 Build-CMakeProject `
13151331 - Src $SourceCache \llvm- project\llvm `
13161332 - Bin $CompilersBinaryCache `
@@ -1323,6 +1339,7 @@ function Build-Compilers() {
13231339 - Defines ($TestingDefines + @ {
13241340 CLANG_TABLEGEN = (Join-Path - Path $BuildTools - ChildPath " clang-tblgen.exe" );
13251341 CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path - Path $BuildTools - ChildPath " clang-tidy-confusable-chars-gen.exe" );
1342+ CMAKE_Swift_FLAGS = $SwiftFlags ;
13261343 LLDB_PYTHON_EXE_RELATIVE_PATH = " python.exe" ;
13271344 LLDB_PYTHON_EXT_SUFFIX = " .pyd" ;
13281345 LLDB_PYTHON_RELATIVE_PATH = " lib/site-packages" ;
0 commit comments