@@ -5463,7 +5463,16 @@ class ParamDecl : public VarDecl {
5463
5463
friend class DefaultArgumentInitContextRequest ;
5464
5464
friend class DefaultArgumentExprRequest ;
5465
5465
5466
- llvm::PointerIntPair<Identifier, 1 , bool > ArgumentNameAndDestructured;
5466
+ enum class ArgumentNameFlags : uint8_t {
5467
+ // / Whether or not this parameter is destructed.
5468
+ Destructured = 1 << 0 ,
5469
+
5470
+ // / Whether or not this parameter is '_const'.
5471
+ IsCompileTimeConst = 1 << 1 ,
5472
+ };
5473
+
5474
+ llvm::PointerIntPair<Identifier, 2 , OptionSet<ArgumentNameFlags>>
5475
+ ArgumentNameAndFlags;
5467
5476
SourceLoc ParameterNameLoc;
5468
5477
SourceLoc ArgumentNameLoc;
5469
5478
SourceLoc SpecifierLoc;
@@ -5494,13 +5503,10 @@ class ParamDecl : public VarDecl {
5494
5503
5495
5504
// / Whether or not this parameter is 'isolated'.
5496
5505
IsIsolated = 1 << 2 ,
5497
-
5498
- // / Whether or not this parameter is '_const'.
5499
- IsCompileTimeConst = 1 << 3 ,
5500
5506
};
5501
5507
5502
5508
// / The default value, if any, along with flags.
5503
- llvm::PointerIntPair<StoredDefaultArgument *, 4 , OptionSet<Flags>>
5509
+ llvm::PointerIntPair<StoredDefaultArgument *, 3 , OptionSet<Flags>>
5504
5510
DefaultValueAndFlags;
5505
5511
5506
5512
friend class ParamSpecifierRequest ;
@@ -5518,7 +5524,7 @@ class ParamDecl : public VarDecl {
5518
5524
5519
5525
// / Retrieve the argument (API) name for this function parameter.
5520
5526
Identifier getArgumentName () const {
5521
- return ArgumentNameAndDestructured .getPointer ();
5527
+ return ArgumentNameAndFlags .getPointer ();
5522
5528
}
5523
5529
5524
5530
// / Retrieve the parameter (local) name for this function parameter.
@@ -5538,8 +5544,17 @@ class ParamDecl : public VarDecl {
5538
5544
TypeRepr *getTypeRepr () const { return TyRepr; }
5539
5545
void setTypeRepr (TypeRepr *repr) { TyRepr = repr; }
5540
5546
5541
- bool isDestructured () const { return ArgumentNameAndDestructured.getInt (); }
5542
- void setDestructured (bool repr) { ArgumentNameAndDestructured.setInt (repr); }
5547
+ bool isDestructured () const {
5548
+ auto flags = ArgumentNameAndFlags.getInt ();
5549
+ return flags.contains (ArgumentNameFlags::Destructured);
5550
+ }
5551
+
5552
+ void setDestructured (bool repr) {
5553
+ auto flags = ArgumentNameAndFlags.getInt ();
5554
+ flags = repr ? flags | ArgumentNameFlags::Destructured
5555
+ : flags - ArgumentNameFlags::Destructured;
5556
+ ArgumentNameAndFlags.setInt (flags);
5557
+ }
5543
5558
5544
5559
DefaultArgumentKind getDefaultArgumentKind () const {
5545
5560
return static_cast <DefaultArgumentKind>(Bits.ParamDecl .defaultArgumentKind );
@@ -5671,13 +5686,15 @@ class ParamDecl : public VarDecl {
5671
5686
5672
5687
// / Whether or not this parameter is marked with '_const'.
5673
5688
bool isCompileTimeConst () const {
5674
- return DefaultValueAndFlags.getInt ().contains (Flags::IsCompileTimeConst);
5689
+ return ArgumentNameAndFlags.getInt ().contains (
5690
+ ArgumentNameFlags::IsCompileTimeConst);
5675
5691
}
5676
5692
5677
5693
void setCompileTimeConst (bool value = true ) {
5678
- auto flags = DefaultValueAndFlags.getInt ();
5679
- DefaultValueAndFlags.setInt (value ? flags | Flags::IsCompileTimeConst
5680
- : flags - Flags::IsCompileTimeConst);
5694
+ auto flags = ArgumentNameAndFlags.getInt ();
5695
+ flags = value ? flags | ArgumentNameFlags::IsCompileTimeConst
5696
+ : flags - ArgumentNameFlags::IsCompileTimeConst;
5697
+ ArgumentNameAndFlags.setInt (flags);
5681
5698
}
5682
5699
5683
5700
// / Does this parameter reject temporary pointer conversions?
0 commit comments