22//
33// This source file is part of the Swift.org open source project
44//
5- // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+ // Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
66// Licensed under Apache License v2.0 with Runtime Library Exception
77//
88// See https://swift.org/LICENSE.txt for license information
1717#ifndef SWIFT_ATTRKIND_H
1818#define SWIFT_ATTRKIND_H
1919
20- #include " swift/Basic/InlineBitfield.h"
21- #include " swift/Basic/LLVM.h"
22- #include " swift/Config.h"
23- #include " llvm/Support/DataTypes.h"
20+ // / This header is included in a bridging header. Be *very* careful with what
21+ // / you include here! See include caveats in `ASTBridging.h`.
22+ #include " swift/Basic/SwiftBridging.h"
23+ #include < stdint.h>
24+
25+ namespace llvm {
26+ class StringRef ;
27+ }
2428
2529namespace swift {
2630
@@ -41,14 +45,8 @@ enum class Associativity : uint8_t {
4145};
4246
4347// / Returns the in-source spelling of the given associativity.
44- StringRef getAssociativitySpelling (Associativity value);
45-
46- // / The kind of unary operator, if any.
47- enum class UnaryOperatorKind : uint8_t {
48- None,
49- Prefix,
50- Postfix
51- };
48+ SWIFT_UNAVAILABLE (" Unavailable in Swift" )
49+ llvm::StringRef getAssociativitySpelling (Associativity value);
5250
5351// / Access control levels.
5452// These are used in diagnostics and with < and similar operations,
@@ -74,18 +72,15 @@ enum class AccessLevel : uint8_t {
7472};
7573
7674// / Returns the in-source spelling of the given access level.
77- StringRef getAccessLevelSpelling (AccessLevel value);
75+ SWIFT_UNAVAILABLE (" Unavailable in Swift" )
76+ llvm::StringRef getAccessLevelSpelling (AccessLevel value);
7877
7978enum class InlineKind : uint8_t {
8079 Never = 0 ,
8180 Always = 1 ,
8281 Last_InlineKind = Always
8382};
8483
85- enum : unsigned { NumInlineKindBits =
86- countBitsUsed (static_cast <unsigned >(InlineKind::Last_InlineKind)) };
87-
88-
8984// / This enum represents the possible values of the @_effects attribute.
9085// / These values are ordered from the strongest guarantee to the weakest,
9186// / so please do not reorder existing values.
@@ -99,19 +94,9 @@ enum class EffectsKind : uint8_t {
9994 Last_EffectsKind = Unspecified
10095};
10196
102- enum : unsigned { NumEffectsKindBits =
103- countBitsUsed (static_cast <unsigned >(EffectsKind::Last_EffectsKind)) };
104-
10597// / This enum represents the possible values of the @_expose attribute.
106- enum class ExposureKind : uint8_t {
107- Cxx,
108- Wasm,
109- Last_ExposureKind = Wasm
110- };
98+ enum class ExposureKind : uint8_t { Cxx, Wasm, Last_ExposureKind = Wasm };
11199
112- enum : unsigned { NumExposureKindBits =
113- countBitsUsed (static_cast <unsigned >(ExposureKind::Last_ExposureKind)) };
114-
115100// / This enum represents the possible values of the @_extern attribute.
116101enum class ExternKind : uint8_t {
117102 // / Reference an externally defined C function.
@@ -127,21 +112,13 @@ enum class ExternKind: uint8_t {
127112 Last_ExternKind = Wasm
128113};
129114
130- enum : unsigned { NumExternKindBits =
131- countBitsUsed (static_cast <unsigned >(ExternKind::Last_ExternKind)) };
132-
133115enum class NonIsolatedModifier : uint8_t {
134116 None = 0 ,
135117 Unsafe,
136118 NonSending,
137119 Last_NonIsolatedModifier = NonSending
138120};
139121
140- enum : unsigned {
141- NumNonIsolatedModifierBits = countBitsUsed (
142- static_cast <unsigned >(NonIsolatedModifier::Last_NonIsolatedModifier))
143- };
144-
145122enum class InheritActorContextModifier : uint8_t {
146123 // / Inherit the actor execution context if the isolated parameter was
147124 // / captured by the closure, context is nonisolated or isolated to a
@@ -153,22 +130,17 @@ enum class InheritActorContextModifier : uint8_t {
153130 Last_InheritActorContextKind = Always
154131};
155132
156- enum : unsigned {
157- NumInheritActorContextKindBits = countBitsUsed (static_cast <unsigned >(
158- InheritActorContextModifier::Last_InheritActorContextKind))
159- };
160-
161- enum class DeclAttrKind : unsigned {
133+ enum class ENUM_EXTENSIBILITY_ATTR (closed) DeclAttrKind : unsigned {
162134#define DECL_ATTR (_, CLASS, ...) CLASS,
163135#define LAST_DECL_ATTR (CLASS ) Last_DeclAttr = CLASS,
164136#include " swift/AST/DeclAttr.def"
165137};
166138
167- StringRef getDeclAttrKindID (DeclAttrKind kind);
139+ SWIFT_UNAVAILABLE (" Unavailable in Swift" )
140+ llvm::StringRef getDeclAttrKindID (DeclAttrKind kind);
168141
169142enum : unsigned {
170- NumDeclAttrKinds = static_cast <unsigned >(DeclAttrKind::Last_DeclAttr) + 1 ,
171- NumDeclAttrKindBits = countBitsUsed (NumDeclAttrKinds - 1 ),
143+ NumDeclAttrKinds = static_cast <unsigned >(DeclAttrKind::Last_DeclAttr) + 1
172144};
173145
174146// Define enumerators for each type attribute, e.g. TypeAttrKind::Weak.
@@ -179,8 +151,7 @@ enum class TypeAttrKind {
179151};
180152
181153enum : unsigned {
182- NumTypeAttrKinds = static_cast <unsigned >(TypeAttrKind::Last_TypeAttr) + 1 ,
183- NumTypeAttrKindBits = countBitsUsed (NumTypeAttrKinds - 1 ),
154+ NumTypeAttrKinds = static_cast <unsigned >(TypeAttrKind::Last_TypeAttr) + 1
184155};
185156
186157} // end namespace swift
0 commit comments