Skip to content

Commit 30b1c96

Browse files
committed
Update LAST_DECL_ATTR and add verification
1 parent 5d5627a commit 30b1c96

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

include/swift/AST/DeclAttr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ DECL_ATTR(lifetime, Lifetime,
510510
OnAccessor | OnConstructor | OnFunc | OnSubscript | LongAttribute | ABIBreakingToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove,
511511
161)
512512

513-
LAST_DECL_ATTR(Unsafe)
513+
LAST_DECL_ATTR(Lifetime)
514514

515515
#undef DECL_ATTR_ALIAS
516516
#undef CONTEXTUAL_DECL_ATTR_ALIAS

lib/AST/Attr.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
using namespace swift;
4040

4141
#define DECL_ATTR(_, Id, ...) \
42+
static_assert(DeclAttrKind::Id <= DeclAttrKind::Last_DeclAttr); \
4243
static_assert(IsTriviallyDestructible<Id##Attr>::value, \
4344
"Attrs are BumpPtrAllocated; the destructor is never called");
4445
#include "swift/AST/DeclAttr.def"
@@ -69,6 +70,10 @@ static_assert(DeclAttribute::isOptionSetFor##Id(DeclAttribute::DeclAttrOptions::
6970
#Name " needs to specify either APIBreakingToRemove or APIStableToRemove");
7071
#include "swift/AST/DeclAttr.def"
7172

73+
#define TYPE_ATTR(_, Id) \
74+
static_assert(TypeAttrKind::Id <= TypeAttrKind::Last_TypeAttr);
75+
#include "swift/AST/TypeAttr.def"
76+
7277
StringRef swift::getAccessLevelSpelling(AccessLevel value) {
7378
switch (value) {
7479
case AccessLevel::Private: return "private";

0 commit comments

Comments
 (0)