@@ -5458,7 +5458,16 @@ class ParamDecl : public VarDecl {
5458
5458
friend class DefaultArgumentInitContextRequest ;
5459
5459
friend class DefaultArgumentExprRequest ;
5460
5460
5461
- llvm::PointerIntPair<Identifier, 1 , bool > ArgumentNameAndDestructured;
5461
+ enum class ArgumentNameFlags : uint8_t {
5462
+ // / Whether or not this parameter is destructed.
5463
+ Destructured = 1 << 0 ,
5464
+
5465
+ // / Whether or not this parameter is '_const'.
5466
+ IsCompileTimeConst = 1 << 1 ,
5467
+ };
5468
+
5469
+ llvm::PointerIntPair<Identifier, 2 , OptionSet<ArgumentNameFlags>>
5470
+ ArgumentNameAndFlags;
5462
5471
SourceLoc ParameterNameLoc;
5463
5472
SourceLoc ArgumentNameLoc;
5464
5473
SourceLoc SpecifierLoc;
@@ -5489,13 +5498,10 @@ class ParamDecl : public VarDecl {
5489
5498
5490
5499
// / Whether or not this parameter is 'isolated'.
5491
5500
IsIsolated = 1 << 2 ,
5492
-
5493
- // / Whether or not this parameter is '_const'.
5494
- IsCompileTimeConst = 1 << 3 ,
5495
5501
};
5496
5502
5497
5503
// / The default value, if any, along with flags.
5498
- llvm::PointerIntPair<StoredDefaultArgument *, 4 , OptionSet<Flags>>
5504
+ llvm::PointerIntPair<StoredDefaultArgument *, 3 , OptionSet<Flags>>
5499
5505
DefaultValueAndFlags;
5500
5506
5501
5507
friend class ParamSpecifierRequest ;
@@ -5513,7 +5519,7 @@ class ParamDecl : public VarDecl {
5513
5519
5514
5520
// / Retrieve the argument (API) name for this function parameter.
5515
5521
Identifier getArgumentName () const {
5516
- return ArgumentNameAndDestructured .getPointer ();
5522
+ return ArgumentNameAndFlags .getPointer ();
5517
5523
}
5518
5524
5519
5525
// / Retrieve the parameter (local) name for this function parameter.
@@ -5533,8 +5539,17 @@ class ParamDecl : public VarDecl {
5533
5539
TypeRepr *getTypeRepr () const { return TyRepr; }
5534
5540
void setTypeRepr (TypeRepr *repr) { TyRepr = repr; }
5535
5541
5536
- bool isDestructured () const { return ArgumentNameAndDestructured.getInt (); }
5537
- void setDestructured (bool repr) { ArgumentNameAndDestructured.setInt (repr); }
5542
+ bool isDestructured () const {
5543
+ auto flags = ArgumentNameAndFlags.getInt ();
5544
+ return flags.contains (ArgumentNameFlags::Destructured);
5545
+ }
5546
+
5547
+ void setDestructured (bool repr) {
5548
+ auto flags = ArgumentNameAndFlags.getInt ();
5549
+ flags = repr ? flags | ArgumentNameFlags::Destructured
5550
+ : flags - ArgumentNameFlags::Destructured;
5551
+ ArgumentNameAndFlags.setInt (flags);
5552
+ }
5538
5553
5539
5554
DefaultArgumentKind getDefaultArgumentKind () const {
5540
5555
return static_cast <DefaultArgumentKind>(Bits.ParamDecl .defaultArgumentKind );
@@ -5666,13 +5681,15 @@ class ParamDecl : public VarDecl {
5666
5681
5667
5682
// / Whether or not this parameter is marked with '_const'.
5668
5683
bool isCompileTimeConst () const {
5669
- return DefaultValueAndFlags.getInt ().contains (Flags::IsCompileTimeConst);
5684
+ return ArgumentNameAndFlags.getInt ().contains (
5685
+ ArgumentNameFlags::IsCompileTimeConst);
5670
5686
}
5671
5687
5672
5688
void setCompileTimeConst (bool value = true ) {
5673
- auto flags = DefaultValueAndFlags.getInt ();
5674
- DefaultValueAndFlags.setInt (value ? flags | Flags::IsCompileTimeConst
5675
- : flags - Flags::IsCompileTimeConst);
5689
+ auto flags = ArgumentNameAndFlags.getInt ();
5690
+ flags = value ? flags | ArgumentNameFlags::IsCompileTimeConst
5691
+ : flags - ArgumentNameFlags::IsCompileTimeConst;
5692
+ ArgumentNameAndFlags.setInt (flags);
5676
5693
}
5677
5694
5678
5695
// / Does this parameter reject temporary pointer conversions?
0 commit comments