@@ -5397,7 +5397,16 @@ class ParamDecl : public VarDecl {
5397
5397
friend class DefaultArgumentInitContextRequest ;
5398
5398
friend class DefaultArgumentExprRequest ;
5399
5399
5400
- llvm::PointerIntPair<Identifier, 1 , bool > ArgumentNameAndDestructured;
5400
+ enum class ArgumentNameFlags : uint8_t {
5401
+ // / Whether or not this parameter is destructed.
5402
+ Destructured = 1 << 0 ,
5403
+
5404
+ // / Whether or not this parameter is '_const'.
5405
+ IsCompileTimeConst = 1 << 1 ,
5406
+ };
5407
+
5408
+ llvm::PointerIntPair<Identifier, 2 , OptionSet<ArgumentNameFlags>>
5409
+ ArgumentNameAndFlags;
5401
5410
SourceLoc ParameterNameLoc;
5402
5411
SourceLoc ArgumentNameLoc;
5403
5412
SourceLoc SpecifierLoc;
@@ -5428,13 +5437,10 @@ class ParamDecl : public VarDecl {
5428
5437
5429
5438
// / Whether or not this parameter is 'isolated'.
5430
5439
IsIsolated = 1 << 2 ,
5431
-
5432
- // / Whether or not this parameter is '_const'.
5433
- IsCompileTimeConst = 1 << 3 ,
5434
5440
};
5435
5441
5436
5442
// / The default value, if any, along with flags.
5437
- llvm::PointerIntPair<StoredDefaultArgument *, 4 , OptionSet<Flags>>
5443
+ llvm::PointerIntPair<StoredDefaultArgument *, 3 , OptionSet<Flags>>
5438
5444
DefaultValueAndFlags;
5439
5445
5440
5446
friend class ParamSpecifierRequest ;
@@ -5452,7 +5458,7 @@ class ParamDecl : public VarDecl {
5452
5458
5453
5459
// / Retrieve the argument (API) name for this function parameter.
5454
5460
Identifier getArgumentName () const {
5455
- return ArgumentNameAndDestructured .getPointer ();
5461
+ return ArgumentNameAndFlags .getPointer ();
5456
5462
}
5457
5463
5458
5464
// / Retrieve the parameter (local) name for this function parameter.
@@ -5472,8 +5478,17 @@ class ParamDecl : public VarDecl {
5472
5478
TypeRepr *getTypeRepr () const { return TyRepr; }
5473
5479
void setTypeRepr (TypeRepr *repr) { TyRepr = repr; }
5474
5480
5475
- bool isDestructured () const { return ArgumentNameAndDestructured.getInt (); }
5476
- void setDestructured (bool repr) { ArgumentNameAndDestructured.setInt (repr); }
5481
+ bool isDestructured () const {
5482
+ auto flags = ArgumentNameAndFlags.getInt ();
5483
+ return flags.contains (ArgumentNameFlags::Destructured);
5484
+ }
5485
+
5486
+ void setDestructured (bool repr) {
5487
+ auto flags = ArgumentNameAndFlags.getInt ();
5488
+ flags = repr ? flags | ArgumentNameFlags::Destructured
5489
+ : flags - ArgumentNameFlags::Destructured;
5490
+ ArgumentNameAndFlags.setInt (flags);
5491
+ }
5477
5492
5478
5493
DefaultArgumentKind getDefaultArgumentKind () const {
5479
5494
return static_cast <DefaultArgumentKind>(Bits.ParamDecl .defaultArgumentKind );
@@ -5605,13 +5620,15 @@ class ParamDecl : public VarDecl {
5605
5620
5606
5621
// / Whether or not this parameter is marked with '_const'.
5607
5622
bool isCompileTimeConst () const {
5608
- return DefaultValueAndFlags.getInt ().contains (Flags::IsCompileTimeConst);
5623
+ return ArgumentNameAndFlags.getInt ().contains (
5624
+ ArgumentNameFlags::IsCompileTimeConst);
5609
5625
}
5610
5626
5611
5627
void setCompileTimeConst (bool value = true ) {
5612
- auto flags = DefaultValueAndFlags.getInt ();
5613
- DefaultValueAndFlags.setInt (value ? flags | Flags::IsCompileTimeConst
5614
- : flags - Flags::IsCompileTimeConst);
5628
+ auto flags = ArgumentNameAndFlags.getInt ();
5629
+ flags = value ? flags | ArgumentNameFlags::IsCompileTimeConst
5630
+ : flags - ArgumentNameFlags::IsCompileTimeConst;
5631
+ ArgumentNameAndFlags.setInt (flags);
5615
5632
}
5616
5633
5617
5634
// / Does this parameter reject temporary pointer conversions?
0 commit comments