-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add support for a declaration attribute @warn for source-level warning group behavior control
#85036
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
artemcm
wants to merge
2
commits into
swiftlang:main
Choose a base branch
from
artemcm:AddSupportForWarnAttr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,026
−219
Conversation
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
efeb7d8 to
f2090a1
Compare
b5ce4d2 to
f166258
Compare
Contributor
Author
|
@swift-ci test |
f346cd4 to
213b207
Compare
09ccd1f to
b22b692
Compare
DougGregor
reviewed
Nov 7, 2025
Member
DougGregor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this :)
b22b692 to
693aeae
Compare
Contributor
Author
693aeae to
72a0e52
Compare
Contributor
Author
@warn for source-level warning group behavior control
72a0e52 to
8019c96
Compare
Contributor
Author
|
@swift-ci test |
8019c96 to
3c08854
Compare
Contributor
Author
|
@swift-ci test |
Contributor
Author
…ing group behavior control
3c08854 to
9ac4a7f
Compare
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test Windows platform |
Contributor
Author
|
@swift-ci test Linux platform |
…nostic Unified across module-wide configuration flags (`-Wwarning`, `-Werror`, etc.) and syntactic configuration attribute `@warn`.
9ac4a7f to
e2f23c1
Compare
Contributor
Author
|
@swift-ci test |
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 PR contains two changes/commits:
Add parsing for an experimental declaration attribute '@warn' for source-level warning group behavior control. This attribute is gated behind an experimental feature
SourceWarningControl.Implement support for unified warning group behavior queries per-diagnostic-group:
-Wwarningand-Werrorflags, as well asDefaultIgnorediagnostic groups to be captured as aWarningGroupBehaviorRule(as opposed to a priorWarningAsErrorRule) and replace the corresponding diagnostic group ID-indexed bit vectors inDiagnosticEnginewith with a dictionary keyed by the diagnostic group ID with values representing behavior specification rules (such asAsError,AsWarning,Ignored).SwiftWarningControlSwiftSyntax library for a given warning diagnostic's diagnostic group's emission behavior at the diagnostic's source location, as determined by syntactic@warncontrols. (Implemented inASTGen/WarningGroupBehaviorConfiguration.swift).SwiftWarningControlquery as global control inputs. This means the same query will take into account both global warning control rules specified on the command-line, as well as source-location-specific containing@warnattribute controls.ExportedSourceFile, the first query ofwarningGroupBehaviorAtPositionwill result in construction of aWarningControlRegionTreedata-structure which will be cached in theExportedSourceFileit belongs to and re-used for future queries.