Skip to content

Commit e4bec41

Browse files
committed
[AST] Demote @noescape and @async to SIL attributes
These aren't currently claimed by anything other than SILFunctions, and as such are invalid in regular Swift code. Treat them as SIL type attributes. Also while here, fix the SIL reference attributes to be SIL attributes.
1 parent 7cfbe97 commit e4bec41

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

include/swift/AST/TypeAttr.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@
5353
// Type attributes
5454
SIMPLE_TYPE_ATTR(autoclosure, Autoclosure)
5555
TYPE_ATTR(convention, Convention)
56-
SIMPLE_TYPE_ATTR(noescape, NoEscape)
5756
SIMPLE_TYPE_ATTR(escaping, Escaping)
5857
TYPE_ATTR(differentiable, Differentiable)
5958
SIMPLE_TYPE_ATTR(noDerivative, NoDerivative)
60-
SIMPLE_TYPE_ATTR(async, Async)
6159
SIMPLE_TYPE_ATTR(Sendable, Sendable)
6260
SIMPLE_TYPE_ATTR(retroactive, Retroactive)
6361
SIMPLE_TYPE_ATTR(unchecked, Unchecked)
@@ -68,10 +66,11 @@ TYPE_ATTR(_opaqueReturnTypeOf, OpaqueReturnTypeOf)
6866
TYPE_ATTR(isolated, Isolated)
6967

7068
// SIL-specific attributes
69+
SIMPLE_SIL_TYPE_ATTR(async, Async)
7170
SIMPLE_SIL_TYPE_ATTR(block_storage, BlockStorage)
7271
SIMPLE_SIL_TYPE_ATTR(box, Box)
7372
SIMPLE_SIL_TYPE_ATTR(dynamic_self, DynamicSelf)
74-
#define REF_STORAGE(Name, name, ...) SIMPLE_TYPE_ATTR(sil_##name, SIL##Name)
73+
#define REF_STORAGE(Name, name, ...) SIMPLE_SIL_TYPE_ATTR(sil_##name, SIL##Name)
7574
#include "swift/AST/ReferenceStorage.def"
7675
SIMPLE_SIL_TYPE_ATTR(error, Error)
7776
SIMPLE_SIL_TYPE_ATTR(error_indirect, ErrorIndirect)
@@ -84,6 +83,7 @@ SIMPLE_SIL_TYPE_ATTR(inout_aliasable, InoutAliasable)
8483
SIMPLE_SIL_TYPE_ATTR(in_guaranteed, InGuaranteed)
8584
SIMPLE_SIL_TYPE_ATTR(in_cxx, InCXX)
8685
SIMPLE_SIL_TYPE_ATTR(in_constant, InConstant)
86+
SIMPLE_SIL_TYPE_ATTR(noescape, NoEscape)
8787
SIMPLE_SIL_TYPE_ATTR(pack_owned, PackOwned)
8888
SIMPLE_SIL_TYPE_ATTR(pack_guaranteed, PackGuaranteed)
8989
SIMPLE_SIL_TYPE_ATTR(pack_inout, PackInout)

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,6 @@ static bool isSILAttribute(TypeAttrKind attrKind) {
31133113
switch (attrKind) {
31143114
#define SIL_TYPE_ATTR(SPELLING, CLASS) case TypeAttrKind::CLASS:
31153115
#include "swift/AST/TypeAttr.def"
3116-
case TypeAttrKind::NoEscape: // noescape is only used in SIL now
31173116
return true;
31183117

31193118
default:

0 commit comments

Comments
 (0)