[Diags] Add support for remarks in diagnostic groups#88516
Draft
hnrklssn wants to merge 9 commits into
Draft
Conversation
Member
Author
|
@swift-ci please test |
This adds a flag to swift-ide-test emitting a list of all diagnostic groups, and a test checking that there is a corresponding markdown file for each group. The flag is in swift-ide-test rather than swift-frontend since it's only intended to be used for testing. Also adds some initial documentation for RegionIsolation and WeakMutability which was previously missing.
This creates groups for all current remarks and adds them to their corresponding groups. These groups currently don't do anything other than displaying documentation alongside the remark. Add a FrontendOnly option to DiagnosticGroupOptions for groups that should not be accessible from the Swift driver. This will be used to match their current behavior. Remove the unused remark_scanner_uncached_lookups diagnostic. Also adds some basic documentation for each new diagnostic group.
This creates `resolveDiagnosticDocumentationPath`, `resolveLocalDiagnosticDocumentationPath` as static functions in `DiagnosticEngine`. `declaredDiagnosticKindFor` is converted to a static function. `getDocumentationURL` is added to `DiagGroupInfo`. These functions will be used before `configureDiagnosticEngine` is called as part of the `-Rhelp` implementation in the next commit. `::DiagnosticOptions` is also renamed to `::DiagnosticProperties` to avoid clashing with `swift::DiagnosticOptions`.
-Rhelp checks all diagnostic groups for the presence of remarks, and lists them together with URLs to their documentation.
Instead of manually adding new `-Rfoo` options each time we add a new kind of remark, this adds a generic `-R Foo` option to enable any remark diagnostics group. Existing `-Rfoo` options are made into aliases of this new option. For compatibility, parsing of the new option sets the same boolean flags as the corresponding old options did. Over time it is expected that this will be handled by querying the DiagnosticsEngine whether a certain remark is enabled or not, or even just emitting the remark and letting the engine silence it. Like with `-Rhelp`, to prevent matching frontend-only remark groups when `-R` is passed to the driver, `-R` is actually split up into `-R` and `-Rswiftc`. `-R` is available in both the driver and the compiler, whereas `-Rswiftc` is only available in the compiler. When `-R` is passed to the driver, it forwards `-Rswiftc` to the compiler to prevent matching frontend-only groups.
Member
Author
|
@swift-ci please test |
hnrklssn
added a commit
to hnrklssn/swift-driver
that referenced
this pull request
Apr 18, 2026
When passed to the driver, these options are remapped to -Rhelp-swiftc and -Rswiftc, respectively, before invoking the compiler. This lets the compiler gate remark availability on whether the options were passed to the driver or to the compiler directly. the -R*-swiftc versions are not to be used directly. Paired with swiftlang/swift#88516
Member
Author
|
swiftlang/swift-driver#2124 |
Member
Author
|
swiftlang/swift-driver#2124 |
This file was accidentally leftover as duplicated content after renaming to modularization-issue.md.
Member
Author
|
swiftlang/swift-driver#2124 |
1 similar comment
Member
Author
|
swiftlang/swift-driver#2124 |
Member
Author
|
CI Failure: Swift Test Windows Platform Reason: Infrastructure error detected Automatically retriggering CI to verify if this is a transient infrastructure issue. |
Member
Author
|
@swift-ci please test windows platform |
artemcm
reviewed
Apr 22, 2026
| "failed inside dependency scanner: '%0'", (StringRef)) | ||
|
|
||
| REMARK(warn_scanner_deserialize_failed, none, | ||
| GROUPED_REMARK(warn_scanner_deserialize_failed, DependencyScanCache, none, |
Contributor
There was a problem hiding this comment.
Should it be possible to have an un-grouped remark with this change? i.e. should all remarks just be REMARK and require a group?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds:
-R FooBar)-Rhelpto list groups containing remarks, along with links to their docsExisting remark options are turned into aliases of the new
-R <group>for compatibility. The exception is-Raccess-note=<level>which is not supported by the new option for two reasons:This resolves #87756
Leaving this as draft for now since I'm not sure whether this will go into 6.4.