Skip to content

Commit 2fb5afb

Browse files
committed
Remove the @_downgrade_exhaustivity_check hack
This hack was only needed for Swift 3 mode in a narrow case. Flush it out of the compiler so we can simplify the space engine.
1 parent f97d13d commit 2fb5afb

File tree

15 files changed

+40
-240
lines changed

15 files changed

+40
-240
lines changed

include/swift/AST/Attr.def

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,7 @@ DECL_ATTR(_restatedObjCConformance, RestatedObjCConformance,
345345
OnProtocol |
346346
LongAttribute | RejectByParser |
347347
NotSerialized, 70)
348-
// HACK: Attribute needed to preserve source compatibility by downgrading errors
349-
// due to an SDK change in Dispatch
350-
SIMPLE_DECL_ATTR(_downgrade_exhaustivity_check, DowngradeExhaustivityCheck,
351-
OnEnumElement |
352-
LongAttribute | UserInaccessible,
353-
71)
348+
// NOTE: 71 is unused
354349
SIMPLE_DECL_ATTR(_implicitly_unwrapped_optional, ImplicitlyUnwrappedOptional,
355350
OnFunc | OnAccessor | OnVar | OnParam | OnSubscript | OnConstructor |
356351
RejectByParser,

include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const uint16_t VERSION_MAJOR = 0;
5555
/// describe what change you made. The content of this comment isn't important;
5656
/// it just ensures a conflict if two people change the module format.
5757
/// Don't worry about adhering to the 80-column limit for this line.
58-
const uint16_t VERSION_MINOR = 438; // Last change: add isbitwisetakable
58+
const uint16_t VERSION_MINOR = 439; // Last change: remove @_downgrade_exhaustivity_check attribute
5959

6060
using DeclIDField = BCFixed<31>;
6161

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,6 @@ namespace {
862862

863863
void visitEnumElementDecl(EnumElementDecl *EED) {
864864
printCommon(EED, "enum_element_decl");
865-
if (EED->getAttrs().hasAttribute<DowngradeExhaustivityCheckAttr>())
866-
OS << "@_downgrade_exhaustivity_check";
867865
PrintWithColorRAII(OS, ParenthesisColor) << ')';
868866
}
869867

lib/SILGen/SILGenPattern.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,8 +1806,7 @@ CaseBlocks::CaseBlocks(
18061806
enumDecl->isEffectivelyExhaustive(SGF.getModule().getSwiftModule(),
18071807
SGF.F.getResilienceExpansion());
18081808
if (canAssumeExhaustive) {
1809-
// Check that Sema didn't let any cases slip through. (This can happen
1810-
// with @_downgrade_exhaustivity_check.)
1809+
// Check that Sema didn't let any cases slip through.
18111810
canAssumeExhaustive = llvm::all_of(enumDecl->getAllElements(),
18121811
[&](const EnumElementDecl *elt) {
18131812
return caseToIndex.count(elt);

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class AttributeEarlyChecker : public AttributeVisitor<AttributeEarlyChecker> {
7878
IGNORED_ATTR(ClangImporterSynthesizedType)
7979
IGNORED_ATTR(Convenience)
8080
IGNORED_ATTR(DiscardableResult)
81-
IGNORED_ATTR(DowngradeExhaustivityCheck)
8281
IGNORED_ATTR(DynamicMemberLookup)
8382
IGNORED_ATTR(Effects)
8483
IGNORED_ATTR(Exported)
@@ -777,7 +776,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
777776
IGNORED_ATTR(ClangImporterSynthesizedType)
778777
IGNORED_ATTR(Consuming)
779778
IGNORED_ATTR(Convenience)
780-
IGNORED_ATTR(DowngradeExhaustivityCheck)
781779
IGNORED_ATTR(Dynamic)
782780
IGNORED_ATTR(Effects)
783781
IGNORED_ATTR(Exported)

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,6 @@ namespace {
11591159
UNINTERESTING_ATTR(RestatedObjCConformance)
11601160
UNINTERESTING_ATTR(Implements)
11611161
UNINTERESTING_ATTR(StaticInitializeObjCMetadata)
1162-
UNINTERESTING_ATTR(DowngradeExhaustivityCheck)
11631162
UNINTERESTING_ATTR(ImplicitlyUnwrappedOptional)
11641163
UNINTERESTING_ATTR(ClangImporterSynthesizedType)
11651164
UNINTERESTING_ATTR(WeakLinked)

0 commit comments

Comments
 (0)