Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88cc389

Browse files
Steelskincompnerd
andcommitted
🍒 [WindowsDriver] Always consider WinSdkVersion (llvm#130377)
Cherry-picked from swiftlang#10240 Currently, the `-Xmicrosoft-windows-sdk-version` is only used if `-Xmicrosoft-windows-sdk-root` is also provided. This is a surprising behavior since the argument should still be taking effect if LLVM uses the Windows SDK root from the registry. Tested locally in a simple Hello World program including `Windows.h` and compiled with `-Xmicrosoft-windows-sdk-version 10.0.18362.0` on a system where the SDK 10.0.22621.0 is also installed and verified that the correct header was included. Co-authored-by: Saleem Abdulrasool <[email protected]> (cherrry picked from commit [606e9fa](swiftlang@606e9fa)
1 parent 08670c0 commit 88cc389

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/lib/WindowsDriver/MSVCPaths.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,13 @@ bool getWindowsSDKDir(vfs::FileSystem &VFS, std::optional<StringRef> WinSdkDir,
444444
return !WindowsSDKLibVersion.empty();
445445
}
446446
if (Major == 10) {
447+
if (WinSdkVersion) {
448+
// Use the user-provided version as-is.
449+
WindowsSDKIncludeVersion = WinSdkVersion->str();
450+
WindowsSDKLibVersion = WindowsSDKIncludeVersion;
451+
return true;
452+
}
453+
447454
if (!getWindows10SDKVersionFromPath(VFS, Path, WindowsSDKIncludeVersion))
448455
return false;
449456
WindowsSDKLibVersion = WindowsSDKIncludeVersion;
@@ -475,6 +482,12 @@ bool getUniversalCRTSdkDir(vfs::FileSystem &VFS,
475482
Path, nullptr))
476483
return false;
477484

485+
if (WinSdkVersion) {
486+
// Use the user-provided version as-is.
487+
UCRTVersion = WinSdkVersion->str();
488+
return true;
489+
}
490+
478491
return getWindows10SDKVersionFromPath(VFS, Path, UCRTVersion);
479492
}
480493

0 commit comments

Comments
 (0)