Skip to content

ClangImporter: Introduce the #ClangDeclarationImport diagnostic group #81258

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
merged 1 commit into from
May 6, 2025

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented May 2, 2025

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
Copy link
Contributor Author

tshortli commented May 2, 2025

@swift-ci please test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Yes, thank you!

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

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

There's a typo in the docs that you should correct, but the functional changes look fine.

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 force-pushed the clang-importer-warning-group branch from 5eb0b0c to 24fa9c8 Compare May 5, 2025 21:17
@tshortli
Copy link
Contributor Author

tshortli commented May 5, 2025

@swift-ci please smoke test

@tshortli tshortli enabled auto-merge May 5, 2025 21:17
@tshortli tshortli merged commit 3323d61 into swiftlang:main May 6, 2025
3 checks passed
@tshortli tshortli deleted the clang-importer-warning-group branch May 6, 2025 04:43
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.

3 participants