Skip to content

Honour imported TargetIdentifiers and explain missing toolsets accurately - #9

Merged
wasabii merged 1 commit into
mainfrom
claude/gifted-dubinsky-5144f3
Oct 11, 2026
Merged

wasabii merged 1 commit into
mainfrom
claude/gifted-dubinsky-5144f3

Conversation

@wasabii

@wasabii wasabii commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

Clang projects that set TargetIdentifiers outside the project file (e.g. lib.props in the TestProject, or Directory.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 just Debug|AnyCPU, the design-time build was the outer cross-targeting build, and GetClangCompileCommands/GetLlvmToolset returned 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, as BaseProjectConfigurationDimensionProvider in dotnet/project-system does for TargetFrameworks. 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 the LlvmToolset rule), CrossTargeting (configured project evaluates IsCrossTargetingBuild=true), or NotReturned (rule present, design-time build returned nothing). Only NotSupported suggests updating the SDK; the Error List and clangd info bar share the wording via ClangToolset.ExplainNotReported.

Verification

In the VS 2026 experimental instance with the TestProject solution:

  • all four projects trace the 11 target identifiers from lib.props, and the active group is Debug|AnyCPU|win-x64 … osx-arm64;
  • every context reports its toolset and compile commands; the misleading SDK warning is gone;
  • hello1.c shows all 11 SharedLibrary1 (…) contexts, switching works, and clangd serves semantic tokens, symbols and diagnostics.

The new CrossTargeting/NotReturned messages were not triggered in this run. (stdio.h is not found on this machine because clang itself cannot locate MSVC/the Windows SDK here — unrelated.)

…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.
@wasabii
wasabii merged commit c370a97 into main Oct 11, 2026
4 checks passed
@wasabii
wasabii deleted the claude/gifted-dubinsky-5144f3 branch October 11, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant