Files
swift-mirror/userdocs/diagnostics/clang-declaration-import.md
Allan Shortlidge 24fa9c8703 ClangImporter: Introduce the #ClangDeclarationImport diagnostic group.
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.
2025-05-05 14:16:53 -07:00

18 lines
643 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Imported Clang Declaration Warnings (`ClangDeclarationImport`)
This diagnostic group covers all warnings related to malformed APIs that are imported into Swift from C, C++, and Obj-C headers.
As one example of a potential malformed API diagnostic, suppose a Clang module dependency contained the following declaration:
```
typedef int NotificationIdentifier
__attribute__((swift_name("Notification.Identifier")))
```
The Swift compiler would emit the following warning if no type named `Notification` could be found:
```
warning: imported declaration 'NotificationIdentifier' could not be mapped to 'Notification.Identifier
```