-
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
base: main
Are you sure you want to change the base?
Conversation
efeb7d8 to
f2090a1
Compare
b5ce4d2 to
f166258
Compare
|
@swift-ci test |
f346cd4 to
213b207
Compare
09ccd1f to
b22b692
Compare
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 :)
|
|
||
| std::optional<StringRef> reasonText = std::nullopt; | ||
| if (!reason.getIsEmpty()) | ||
| reasonText = reason.unbridged(); |
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.
Don't we need to copy this string into the ASTContext?
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.
Good catch, thank you.
…ing group behavior control
b22b692 to
693aeae
Compare
…nostic Unified across module-wide configuration flags (`-Wwarning`, `-Werror`, etc.) and syntactic configuration attribute `@warn`.
693aeae to
72a0e52
Compare
@warn for source-level warning group behavior control
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.