Skip to content

[6.2] ClangImporter: Introduce the #ClangDeclarationImport diagnostic group #81307

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

Merged

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented May 5, 2025

  • Explanation: The warnings that ClangImporter emits about issues it encounters while importing declarations from Clang modules should all belong to a diagnostic group so that users of -warnings-as-errors can control their behavior using the compiler flags introduce with SE-0443. It's especially important that these diagnostics be controllable since they are often caused by external dependencies and therefore the developer may not have any control over whether they are emitted.
  • Scope: Affects ClangImporter diagnostics.
  • Issue/Radar: rdar://150524204
  • Original PR: ClangImporter: Introduce the #ClangDeclarationImport diagnostic group #81258
  • Risk: Low. This is mostly an additive change that allows developers to opt-in to controlling the behavior of certain diagnostics. It shouldn't have any effect on existing projects other than causing these diagnostics to be printed with their new diagnostic group name.
  • Testing: Updated existing compiler tests to verify that the diagnostic group name was associated with the existing diagnostics.
  • Reviewer: @beccadax and @DougGregor

The warnings that ClangImporter emits about issues it encounters while
importing declarations from Clang modules should all belong to a diagnostic
group so that users of `-warnings-as-errors` can control their behavior using
the compiler flags introduce with SE-0443. It's especially important that these
diagnostics be controllable since they are often caused by external
dependencies and therefore the developer may not have any control over whether
they are emitted.

The `#ClangDeclarationImport` diagnostic group is intentionally broad so that
developers have a way to control all of these diagnostics with a single
`-Wwarning` flag. I fully expect that we'll introduce finer-grained diagnostic
groups for some of these diagnostics in the future, but those groups should be
hierarchically nested under `#ClangDeclarationImport`, which is supported by
SE-0443.

Resolves rdar://150524204.
@tshortli tshortli requested a review from a team as a code owner May 5, 2025 21:23
@tshortli tshortli changed the title ClangImporter: Introduce the #ClangDeclarationImport diagnostic group. [6.2] ClangImporter: Introduce the #ClangDeclarationImport diagnostic group May 5, 2025
@tshortli
Copy link
Contributor Author

tshortli commented May 5, 2025

@swift-ci please test

@tshortli tshortli enabled auto-merge May 5, 2025 21:23
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.

This is a quite safe change.

@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels May 5, 2025
@tshortli tshortli merged commit 44ecddd into swiftlang:release/6.2 May 6, 2025
5 checks passed
@tshortli tshortli deleted the clang-importer-warning-group-6.2 branch May 6, 2025 13:47
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