Skip to content

Commit b839718

Browse files
committed
[AST] Use scoped enum for attribute kinds
Align with other kind enum e.g. DeclKind.
1 parent 07bb038 commit b839718

39 files changed

+894
-849
lines changed

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class SDKNodeDecl: public SDKNode {
394394
bool isImplicit() const { return IsImplicit; };
395395
bool isStatic() const { return IsStatic; };
396396
bool isOverriding() const { return IsOverriding; };
397-
bool isOptional() const { return hasDeclAttribute(DeclAttrKind::DAK_Optional); }
397+
bool isOptional() const { return hasDeclAttribute(DeclAttrKind::Optional); }
398398
bool isOpen() const { return IsOpen; }
399399
bool isInternal() const { return IsInternal; }
400400
bool isABIPlaceholder() const { return IsABIPlaceholder; }
@@ -492,9 +492,7 @@ class SDKNodeTypeNominal : public SDKNodeType {
492492
class SDKNodeTypeFunc : public SDKNodeType {
493493
public:
494494
SDKNodeTypeFunc(SDKNodeInitInfo Info);
495-
bool isEscaping() const {
496-
return hasTypeAttribute(TypeAttrKind::TAK_NoEscape);
497-
}
495+
bool isEscaping() const { return hasTypeAttribute(TypeAttrKind::NoEscape); }
498496
static bool classof(const SDKNode *N);
499497
void diagnose(SDKNode *Right) override;
500498
};

include/swift/AST/ASTBridgingWrappers.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#include "swift/AST/PatternNodes.def"
6262

6363
#ifndef DECL_ATTR
64-
#define SIMPLE_DECL_ATTR(X, CLASS, OPTIONS, CODE)
64+
#define SIMPLE_DECL_ATTR(...)
6565
#define DECL_ATTR(_, Id, ...) AST_BRIDGING_WRAPPER_NONNULL(Id##Attr)
6666
#endif
6767
#include "swift/AST/Attr.def"

include/swift/AST/ASTVisitor.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,13 @@ class ASTVisitor {
137137

138138
AttributeRetTy visit(DeclAttribute *A, Args... AA) {
139139
switch (A->getKind()) {
140-
#define DECL_ATTR(_, CLASS, ...) \
141-
case DAK_##CLASS: \
142-
return static_cast<ImplClass*>(this) \
143-
->visit##CLASS##Attr(static_cast<CLASS##Attr*>(A), \
144-
::std::forward<Args>(AA)...);
140+
#define DECL_ATTR(_, CLASS, ...) \
141+
case DeclAttrKind::CLASS: \
142+
return static_cast<ImplClass *>(this)->visit##CLASS##Attr( \
143+
static_cast<CLASS##Attr *>(A), ::std::forward<Args>(AA)...);
145144
#include "swift/AST/Attr.def"
146145

147-
case DAK_Count:
146+
case DeclAttrKind::Count:
148147
llvm_unreachable("Not an attribute kind");
149148
}
150149
}

0 commit comments

Comments
 (0)