Files
Artem Chikin ff187ae3b2 [Source Warning Control] Emit canImport diagnostics in ASTGen-only mode
Avoiding the duplicate `cannot_find_module_version` diagnostics routed
`ExportedSourceFile.configuredRegions(astContext:)` through the side-effect-free
`.analyzing` canImport query. For the default C++ parser that is always correct:
its `EvaluateIfConditionRequest` remains the canonical site that emits the
diagnostic and records the result in `CanImportModuleVersions`, and the
configured-regions walk is only a secondary re-derivation used for various
compiler analysis clients (e.g. warning group control).

In ASTGen-only mode (`-enable-experimental-feature ParserASTGen`) the C++
parser, and therefore `EvaluateIfConditionRequest`, never runs; the
configured-regions walk is the only evaluation that drives `canImport`. Routing
it through `.analyzing` consequently suppressed the diagnostic.

This change adds `swift_ASTGen_evaluateConfiguredRegionsForDiagnostics`, invoked
once at the start of `parseSourceFileViaASTGen`, which evaluates the file's
`#if` directives in `.driving` mode to emit the diagnostics and populate the
version cache before any analysis path consumes the configured-regions cache.
2026-06-05 10:44:13 +01:00
..