Skip to content

[6.2 🍒][Dependency Scanning] Emit a detailed error diagnostic on Clang module variant discovery #81337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: release/6.2
Choose a base branch
from

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented May 6, 2025

Cherry-pick of #81313

  • Explanation: In expectation, this should never happen. Such a situation means that within the same scanning action, Clang Dependency Scanner has produced two different variants of the same module. We are currently hunting down the rare cases where it does, seemingly due to differences in Clang Scanner direct by-name queries and transitive header lookup queries and potential other causes. The code-path that this change modifies is only possible to trigger in a case that would already guarantee a build failure down-the-line.

  • Scope: Rare cases where dependency scanning ends up in a situation where it "discovers" two variants of the same Clang module

  • Risk: Low, this change affects only a code-path that would lead to a downstream build failure.

  • Issue: rdar://149230376

  • Reviewed By: @beccadax

  • Original PR: [Dependency Scanning] Emit a detailed error diagnostic on Clang module variant discovery #81313

…e variant discovery

In expectation, this should never happen. Such a situation means that within the same scanning action, Clang Dependency Scanner has produced two different variants of the same module. This is not supposed to happen, but we are currently hunting down the rare cases where it does, seemingly due to differences in Clang Scanner direct by-name queries and transitive header lookup queries.
@artemcm artemcm requested a review from a team as a code owner May 6, 2025 17:17
@artemcm artemcm added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels May 6, 2025
@artemcm
Copy link
Contributor Author

artemcm commented May 6, 2025

@swift-ci test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've seen multiple cases where builds complain about PCM being out of date. The root cause of these failures is mostly project configurations which take a lot of engineering time to track down. Having more detailed and explicit error messages like this helps us track down those issues more efficiently, thus I consider this to be a high value change to be cherry-picked. Additionally, this pure additive diagnostic logics are quite safe too.

@artemcm artemcm enabled auto-merge May 6, 2025 18:00
@@ -618,5 +618,15 @@ ERROR(ast_format_requires_dump_ast,none,
ERROR(unknown_dump_ast_format,none,
"unknown format '%0' requested with '-dump-ast-format'", (StringRef))

ERROR(dependency_scan_unexpected_variant, none,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we downgrade this from error to a warning? I suspect this would happen semi-frequently that a fatal error is probably an overkill.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss more about the implication with @cyndyishida and other folks. Please hold off merging before that.

@nkcsgexi nkcsgexi disabled auto-merge May 7, 2025 00:15
There is concern that this diagnostic may be breaking in some cases on its own.
@artemcm
Copy link
Contributor Author

artemcm commented May 7, 2025

@swift-ci test

@nkcsgexi
Copy link
Contributor

nkcsgexi commented May 7, 2025

Thank you for downgrading to warning Artem! It's then safe enough to be merged for 6.2.

@artemcm artemcm enabled auto-merge May 7, 2025 18:20
@artemcm
Copy link
Contributor Author

artemcm commented May 7, 2025

@swift-ci test macOS platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants