@@ -287,8 +287,12 @@ class alignas(1 << DeclAlignInBits) Decl {
287
287
// / Whether we have already checked whether this declaration is a
288
288
// / redeclaration.
289
289
unsigned CheckedRedeclaration : 1 ;
290
+
291
+ // / Whether the decl can be accessed by swift users; for instance,
292
+ // / a.storage for lazy var a is a decl that cannot be accessed.
293
+ unsigned IsUserAccessible : 1 ;
290
294
};
291
- enum { NumValueDeclBits = NumDeclBits + 2 };
295
+ enum { NumValueDeclBits = NumDeclBits + 3 };
292
296
static_assert (NumValueDeclBits <= 32 , " fits in an unsigned" );
293
297
294
298
class AbstractStorageDeclBitfields {
@@ -328,11 +332,8 @@ class alignas(1 << DeclAlignInBits) Decl {
328
332
// / It is up to the debugger to instruct SIL how to access this variable.
329
333
unsigned IsDebuggerVar : 1 ;
330
334
331
- // / Whether the decl can be accessed by swift users; for instance,
332
- // / a.storage for lazy var a is a decl that cannot be accessed.
333
- unsigned IsUserAccessible : 1 ;
334
335
};
335
- enum { NumVarDeclBits = NumAbstractStorageDeclBits + 6 };
336
+ enum { NumVarDeclBits = NumAbstractStorageDeclBits + 5 };
336
337
static_assert (NumVarDeclBits <= 32 , " fits in an unsigned" );
337
338
338
339
class EnumElementDeclBitfields {
@@ -384,10 +385,8 @@ class alignas(1 << DeclAlignInBits) Decl {
384
385
// / Whether this function has a dynamic Self return type.
385
386
unsigned HasDynamicSelf : 1 ;
386
387
387
- // / Whether we are statically dispatched even if overridable
388
- unsigned ForcedStaticDispatch : 1 ;
389
388
};
390
- enum { NumFuncDeclBits = NumAbstractFunctionDeclBits + 6 };
389
+ enum { NumFuncDeclBits = NumAbstractFunctionDeclBits + 5 };
391
390
static_assert (NumFuncDeclBits <= 32 , " fits in an unsigned" );
392
391
393
392
class ConstructorDeclBitfields {
@@ -401,9 +400,6 @@ class alignas(1 << DeclAlignInBits) Decl {
401
400
// / analysis and SIL generation.
402
401
unsigned ComputedBodyInitKind : 3 ;
403
402
404
- // / The kind of initializer we have.
405
- unsigned InitKind : 2 ;
406
-
407
403
// / Whether this initializer is a stub placed into a subclass to
408
404
// / catch invalid delegations to a designated initializer not
409
405
// / overridden by the subclass. A stub will always trap at runtime.
@@ -413,7 +409,7 @@ class alignas(1 << DeclAlignInBits) Decl {
413
409
// / an object construction that will invoke a stub.
414
410
unsigned HasStubImplementation : 1 ;
415
411
};
416
- enum { NumConstructorDeclBits = NumAbstractFunctionDeclBits + 6 };
412
+ enum { NumConstructorDeclBits = NumAbstractFunctionDeclBits + 4 };
417
413
static_assert (NumConstructorDeclBits <= 32 , " fits in an unsigned" );
418
414
419
415
class TypeDeclBitfields {
@@ -524,10 +520,8 @@ class alignas(1 << DeclAlignInBits) Decl {
524
520
// / control inserting the implicit destructor.
525
521
unsigned HasDestructorDecl : 1 ;
526
522
527
- // / Whether the class has @objc ancestry.
528
- unsigned ObjCClassKind : 3 ;
529
523
};
530
- enum { NumClassDeclBits = NumNominalTypeDeclBits + 11 };
524
+ enum { NumClassDeclBits = NumNominalTypeDeclBits + 8 };
531
525
static_assert (NumClassDeclBits <= 32 , " fits in an unsigned" );
532
526
533
527
class StructDeclBitfields {
@@ -2091,6 +2085,7 @@ class ValueDecl : public Decl {
2091
2085
: Decl(K, context), Name(name), NameLoc(NameLoc) {
2092
2086
ValueDeclBits.AlreadyInLookupTable = false ;
2093
2087
ValueDeclBits.CheckedRedeclaration = false ;
2088
+ ValueDeclBits.IsUserAccessible = true ;
2094
2089
}
2095
2090
2096
2091
public:
@@ -2116,6 +2111,14 @@ class ValueDecl : public Decl {
2116
2111
ValueDeclBits.CheckedRedeclaration = checked;
2117
2112
}
2118
2113
2114
+ void setUserAccessible (bool Accessible) {
2115
+ ValueDeclBits.IsUserAccessible = Accessible;
2116
+ }
2117
+
2118
+ bool isUserAccessible () const {
2119
+ return ValueDeclBits.IsUserAccessible ;
2120
+ }
2121
+
2119
2122
bool hasName () const { return bool (Name); }
2120
2123
// / TODO: Rename to getSimpleName?
2121
2124
Identifier getName () const { return Name.getBaseName (); }
@@ -3183,6 +3186,9 @@ class ClassDecl : public NominalTypeDecl {
3183
3186
SourceLoc ClassLoc;
3184
3187
ObjCMethodLookupTable *ObjCMethodLookup = nullptr ;
3185
3188
3189
+ // / Whether the class has @objc ancestry.
3190
+ unsigned ObjCKind : 3 ;
3191
+
3186
3192
// / Create the Objective-C member lookup table.
3187
3193
void createObjCMethodLookup ();
3188
3194
@@ -4278,7 +4284,6 @@ class VarDecl : public AbstractStorageDecl {
4278
4284
SourceLoc NameLoc, Identifier Name, Type Ty, DeclContext *DC)
4279
4285
: AbstractStorageDecl(Kind, DC, Name, NameLoc)
4280
4286
{
4281
- VarDeclBits.IsUserAccessible = true ;
4282
4287
VarDeclBits.IsStatic = IsStatic;
4283
4288
VarDeclBits.IsLet = IsLet;
4284
4289
VarDeclBits.IsCaptureList = IsCaptureList;
@@ -4300,14 +4305,6 @@ class VarDecl : public AbstractStorageDecl {
4300
4305
4301
4306
SourceRange getSourceRange () const ;
4302
4307
4303
- void setUserAccessible (bool Accessible) {
4304
- VarDeclBits.IsUserAccessible = Accessible;
4305
- }
4306
-
4307
- bool isUserAccessible () const {
4308
- return VarDeclBits.IsUserAccessible ;
4309
- }
4310
-
4311
4308
TypeLoc &getTypeLoc () { return typeLoc; }
4312
4309
TypeLoc getTypeLoc () const { return typeLoc; }
4313
4310
@@ -5031,6 +5028,9 @@ class FuncDecl final : public AbstractFunctionDecl,
5031
5028
unsigned HaveSearchedForCommonOverloadReturnType : 1 ;
5032
5029
unsigned HaveFoundCommonOverloadReturnType : 1 ;
5033
5030
5031
+ // / Whether we are statically dispatched even if overridable
5032
+ unsigned ForcedStaticDispatch : 1 ;
5033
+
5034
5034
// / \brief If this FuncDecl is an accessor for a property, this indicates
5035
5035
// / which property and what kind of accessor.
5036
5036
llvm::PointerIntPair<AbstractStorageDecl*, 3 , AccessorKind> AccessorDecl;
@@ -5060,8 +5060,8 @@ class FuncDecl final : public AbstractFunctionDecl,
5060
5060
assert (NumParameterLists > 0 && " Must have at least an empty tuple arg" );
5061
5061
FuncDeclBits.Mutating = false ;
5062
5062
FuncDeclBits.HasDynamicSelf = false ;
5063
- FuncDeclBits. ForcedStaticDispatch = false ;
5064
-
5063
+
5064
+ ForcedStaticDispatch = false ;
5065
5065
HaveSearchedForCommonOverloadReturnType = false ;
5066
5066
HaveFoundCommonOverloadReturnType = false ;
5067
5067
}
@@ -5291,10 +5291,10 @@ class FuncDecl final : public AbstractFunctionDecl,
5291
5291
5292
5292
// / Returns true if the function is forced to be statically dispatched.
5293
5293
bool hasForcedStaticDispatch () const {
5294
- return FuncDeclBits. ForcedStaticDispatch ;
5294
+ return ForcedStaticDispatch;
5295
5295
}
5296
5296
void setForcedStaticDispatch (bool flag) {
5297
- FuncDeclBits. ForcedStaticDispatch = flag;
5297
+ ForcedStaticDispatch = flag;
5298
5298
}
5299
5299
5300
5300
static bool classof (const Decl *D) { return D->getKind () == DeclKind::Func; }
@@ -5511,6 +5511,9 @@ enum class CtorInitializerKind {
5511
5511
// / }
5512
5512
// / \endcode
5513
5513
class ConstructorDecl : public AbstractFunctionDecl {
5514
+ // / The kind of initializer we have.
5515
+ unsigned InitKind : 2 ;
5516
+
5514
5517
// / The failability of this initializer, which is an OptionalTypeKind.
5515
5518
unsigned Failability : 2 ;
5516
5519
@@ -5616,12 +5619,12 @@ class ConstructorDecl : public AbstractFunctionDecl {
5616
5619
5617
5620
// / Determine the kind of initializer this is.
5618
5621
CtorInitializerKind getInitKind () const {
5619
- return static_cast <CtorInitializerKind>(ConstructorDeclBits. InitKind );
5622
+ return static_cast <CtorInitializerKind>(InitKind);
5620
5623
}
5621
5624
5622
5625
// / Set whether this is a convenience initializer.
5623
5626
void setInitKind (CtorInitializerKind kind) {
5624
- ConstructorDeclBits. InitKind = static_cast <unsigned >(kind);
5627
+ InitKind = static_cast <unsigned >(kind);
5625
5628
}
5626
5629
5627
5630
// / Whether this is a designated initializer.
0 commit comments