@@ -5458,7 +5458,16 @@ class ParamDecl : public VarDecl {
54585458 friend class DefaultArgumentInitContextRequest ;
54595459 friend class DefaultArgumentExprRequest ;
54605460
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;
54625471 SourceLoc ParameterNameLoc;
54635472 SourceLoc ArgumentNameLoc;
54645473 SourceLoc SpecifierLoc;
@@ -5489,13 +5498,10 @@ class ParamDecl : public VarDecl {
54895498
54905499 // / Whether or not this parameter is 'isolated'.
54915500 IsIsolated = 1 << 2 ,
5492-
5493- // / Whether or not this parameter is '_const'.
5494- IsCompileTimeConst = 1 << 3 ,
54955501 };
54965502
54975503 // / The default value, if any, along with flags.
5498- llvm::PointerIntPair<StoredDefaultArgument *, 4 , OptionSet<Flags>>
5504+ llvm::PointerIntPair<StoredDefaultArgument *, 3 , OptionSet<Flags>>
54995505 DefaultValueAndFlags;
55005506
55015507 friend class ParamSpecifierRequest ;
@@ -5513,7 +5519,7 @@ class ParamDecl : public VarDecl {
55135519
55145520 // / Retrieve the argument (API) name for this function parameter.
55155521 Identifier getArgumentName () const {
5516- return ArgumentNameAndDestructured .getPointer ();
5522+ return ArgumentNameAndFlags .getPointer ();
55175523 }
55185524
55195525 // / Retrieve the parameter (local) name for this function parameter.
@@ -5533,8 +5539,17 @@ class ParamDecl : public VarDecl {
55335539 TypeRepr *getTypeRepr () const { return TyRepr; }
55345540 void setTypeRepr (TypeRepr *repr) { TyRepr = repr; }
55355541
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+ }
55385553
55395554 DefaultArgumentKind getDefaultArgumentKind () const {
55405555 return static_cast <DefaultArgumentKind>(Bits.ParamDecl .defaultArgumentKind );
@@ -5666,13 +5681,15 @@ class ParamDecl : public VarDecl {
56665681
56675682 // / Whether or not this parameter is marked with '_const'.
56685683 bool isCompileTimeConst () const {
5669- return DefaultValueAndFlags.getInt ().contains (Flags::IsCompileTimeConst);
5684+ return ArgumentNameAndFlags.getInt ().contains (
5685+ ArgumentNameFlags::IsCompileTimeConst);
56705686 }
56715687
56725688 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);
56765693 }
56775694
56785695 // / Does this parameter reject temporary pointer conversions?
0 commit comments