[llvm] [LLVM] Fix VisualStudio detection (PR #212498)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 06:52:25 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-platform-windows
Author: Vivyy (enginelesscc)
<details>
<summary>Changes</summary>
When packages like SMSS are installed, llvm::findVCToolChainViaSetupConfig will incorrectly assume it is a VS Installation and bail as it wont find `Microsoft.VCToolsVersion.default.txt`, so it will fallback to legacy VS search and ignore VS2019/22/26.
Simplest solution is to check against the InstallationName for "VisualStudio"
---
Full diff: https://github.com/llvm/llvm-project/pull/212498.diff
1 Files Affected:
- (modified) llvm/lib/WindowsDriver/MSVCPaths.cpp (+6)
``````````diff
diff --git a/llvm/lib/WindowsDriver/MSVCPaths.cpp b/llvm/lib/WindowsDriver/MSVCPaths.cpp
index 09468dab10260..de0ddfe5e16e8 100644
--- a/llvm/lib/WindowsDriver/MSVCPaths.cpp
+++ b/llvm/lib/WindowsDriver/MSVCPaths.cpp
@@ -675,6 +675,12 @@ bool llvm::findVCToolChainViaSetupConfig(
ISetupInstancePtr NewestInstance;
std::optional<uint64_t> NewestVersionNum;
do {
+ bstr_t NameString;
+ HR = Instance->GetInstallationName(NameString.GetAddress());
+ if (FAILED(HR))
+ continue;
+ if (std::wstring_view(NameString).find(L"VisualStudio") != 0)
+ continue;
bstr_t VersionString;
uint64_t VersionNum;
HR = Instance->GetInstallationVersion(VersionString.GetAddress());
``````````
</details>
https://github.com/llvm/llvm-project/pull/212498
More information about the llvm-commits
mailing list