Repository navigation
Honour imported TargetIdentifiers and explain missing toolsets accurately - #9
Merged
Merged
Conversation
…tely The configuration dimensions read only an unconditioned literal in the project file, so a project setting TargetIdentifiers in an imported props file got no TargetIdentifier dimension and Visual Studio loaded only the outer cross-targeting build, which has no compile commands or toolset. Like the .NET project system does for TargetFrameworks, read the dimension values and defaults from the evaluation of the suggested configured project, falling back to the project file when none exists yet. The toolset warning blamed the SDK version whenever no toolset was reported. Record why instead: the SDK lacks the LlvmToolset rule, the design-time build was the cross-targeting outer build, or it returned no toolset; and only suggest updating IKVM.Clang.Sdk in the first case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Clang projects that set
TargetIdentifiersoutside the project file (e.g.lib.propsin the TestProject, orDirectory.Build.props) got no TargetIdentifier configuration dimension in Visual Studio. The dimension provider only understood an unconditioned literal in the project XML, so the active configuration was justDebug|AnyCPU, the design-time build was the outer cross-targeting build, andGetClangCompileCommands/GetLlvmToolsetreturned nothing — no clangd completion. The Error List and info bar then told the user to update IKVM.Clang.Sdk, which was wrong.Changes
ClangDimensionProvider: dimension values and defaults now come from the evaluated property of the suggested configured project, asBaseProjectConfigurationDimensionProviderin dotnet/project-system does forTargetFrameworks. Falls back to the project XML when no configured project exists; the best-guess defaults still read only the XML (they run before any configured project exists), also as dotnet does.ClangToolsetStatus: records why a context has no toolset —NotSupported(SDK lacks theLlvmToolsetrule),CrossTargeting(configured project evaluatesIsCrossTargetingBuild=true), orNotReturned(rule present, design-time build returned nothing). OnlyNotSupportedsuggests updating the SDK; the Error List and clangd info bar share the wording viaClangToolset.ExplainNotReported.Verification
In the VS 2026 experimental instance with the TestProject solution:
lib.props, and the active group isDebug|AnyCPU|win-x64 … osx-arm64;hello1.cshows all 11SharedLibrary1 (…)contexts, switching works, and clangd serves semantic tokens, symbols and diagnostics.The new
CrossTargeting/NotReturnedmessages were not triggered in this run. (stdio.his not found on this machine because clang itself cannot locate MSVC/the Windows SDK here — unrelated.)