|
22 | 22 | #include "swift/AST/DeclNameLoc.h"
|
23 | 23 | #include "swift/AST/DiagnosticConsumer.h"
|
24 | 24 | #include "swift/AST/TypeLoc.h"
|
| 25 | +#include "swift/Basic/Version.h" |
25 | 26 | #include "swift/Localization/LocalizationFormat.h"
|
26 | 27 | #include "llvm/ADT/BitVector.h"
|
27 | 28 | #include "llvm/ADT/StringRef.h"
|
@@ -528,6 +529,12 @@ namespace swift {
|
528 | 529 | /// emitted as a warning, but a note will still be emitted as a note.
|
529 | 530 | InFlightDiagnostic &limitBehavior(DiagnosticBehavior limit);
|
530 | 531 |
|
| 532 | + /// Limit the diagnostic behavior to warning until the specified version. |
| 533 | + /// |
| 534 | + /// This helps stage in fixes for stricter diagnostics as warnings |
| 535 | + /// until the next major language version. |
| 536 | + InFlightDiagnostic &warnUntilSwiftVersion(unsigned majorVersion); |
| 537 | + |
531 | 538 | /// Wraps this diagnostic in another diagnostic. That is, \p wrapper will be
|
532 | 539 | /// emitted in place of the diagnostic that otherwise would have been
|
533 | 540 | /// emitted.
|
@@ -803,6 +810,10 @@ namespace swift {
|
803 | 810 | /// Path to diagnostic documentation directory.
|
804 | 811 | std::string diagnosticDocumentationPath = "";
|
805 | 812 |
|
| 813 | + /// The Swift language version. This is used to limit diagnostic behavior |
| 814 | + /// until a specific language version, e.g. Swift 6. |
| 815 | + version::Version languageVersion; |
| 816 | + |
806 | 817 | /// Whether we are actively pretty-printing a declaration as part of
|
807 | 818 | /// diagnostics.
|
808 | 819 | bool IsPrettyPrintingDecl = false;
|
@@ -865,6 +876,8 @@ namespace swift {
|
865 | 876 |
|
866 | 877 | bool isPrettyPrintingDecl() const { return IsPrettyPrintingDecl; }
|
867 | 878 |
|
| 879 | + void setLanguageVersion(version::Version v) { languageVersion = v; } |
| 880 | + |
868 | 881 | void setLocalization(StringRef locale, StringRef path) {
|
869 | 882 | assert(!locale.empty());
|
870 | 883 | assert(!path.empty());
|
|
0 commit comments