@@ -5397,7 +5397,16 @@ class ParamDecl : public VarDecl {
53975397 friend class DefaultArgumentInitContextRequest ;
53985398 friend class DefaultArgumentExprRequest ;
53995399
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;
54015410 SourceLoc ParameterNameLoc;
54025411 SourceLoc ArgumentNameLoc;
54035412 SourceLoc SpecifierLoc;
@@ -5428,13 +5437,10 @@ class ParamDecl : public VarDecl {
54285437
54295438 // / Whether or not this parameter is 'isolated'.
54305439 IsIsolated = 1 << 2 ,
5431-
5432- // / Whether or not this parameter is '_const'.
5433- IsCompileTimeConst = 1 << 3 ,
54345440 };
54355441
54365442 // / The default value, if any, along with flags.
5437- llvm::PointerIntPair<StoredDefaultArgument *, 4 , OptionSet<Flags>>
5443+ llvm::PointerIntPair<StoredDefaultArgument *, 3 , OptionSet<Flags>>
54385444 DefaultValueAndFlags;
54395445
54405446 friend class ParamSpecifierRequest ;
@@ -5452,7 +5458,7 @@ class ParamDecl : public VarDecl {
54525458
54535459 // / Retrieve the argument (API) name for this function parameter.
54545460 Identifier getArgumentName () const {
5455- return ArgumentNameAndDestructured .getPointer ();
5461+ return ArgumentNameAndFlags .getPointer ();
54565462 }
54575463
54585464 // / Retrieve the parameter (local) name for this function parameter.
@@ -5472,8 +5478,17 @@ class ParamDecl : public VarDecl {
54725478 TypeRepr *getTypeRepr () const { return TyRepr; }
54735479 void setTypeRepr (TypeRepr *repr) { TyRepr = repr; }
54745480
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+ }
54775492
54785493 DefaultArgumentKind getDefaultArgumentKind () const {
54795494 return static_cast <DefaultArgumentKind>(Bits.ParamDecl .defaultArgumentKind );
@@ -5605,13 +5620,15 @@ class ParamDecl : public VarDecl {
56055620
56065621 // / Whether or not this parameter is marked with '_const'.
56075622 bool isCompileTimeConst () const {
5608- return DefaultValueAndFlags.getInt ().contains (Flags::IsCompileTimeConst);
5623+ return ArgumentNameAndFlags.getInt ().contains (
5624+ ArgumentNameFlags::IsCompileTimeConst);
56095625 }
56105626
56115627 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);
56155632 }
56165633
56175634 // / Does this parameter reject temporary pointer conversions?
0 commit comments