@@ -5463,7 +5463,16 @@ class ParamDecl : public VarDecl {
54635463 friend class DefaultArgumentInitContextRequest ;
54645464 friend class DefaultArgumentExprRequest ;
54655465
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;
54675476 SourceLoc ParameterNameLoc;
54685477 SourceLoc ArgumentNameLoc;
54695478 SourceLoc SpecifierLoc;
@@ -5494,13 +5503,10 @@ class ParamDecl : public VarDecl {
54945503
54955504 // / Whether or not this parameter is 'isolated'.
54965505 IsIsolated = 1 << 2 ,
5497-
5498- // / Whether or not this parameter is '_const'.
5499- IsCompileTimeConst = 1 << 3 ,
55005506 };
55015507
55025508 // / The default value, if any, along with flags.
5503- llvm::PointerIntPair<StoredDefaultArgument *, 4 , OptionSet<Flags>>
5509+ llvm::PointerIntPair<StoredDefaultArgument *, 3 , OptionSet<Flags>>
55045510 DefaultValueAndFlags;
55055511
55065512 friend class ParamSpecifierRequest ;
@@ -5518,7 +5524,7 @@ class ParamDecl : public VarDecl {
55185524
55195525 // / Retrieve the argument (API) name for this function parameter.
55205526 Identifier getArgumentName () const {
5521- return ArgumentNameAndDestructured .getPointer ();
5527+ return ArgumentNameAndFlags .getPointer ();
55225528 }
55235529
55245530 // / Retrieve the parameter (local) name for this function parameter.
@@ -5538,8 +5544,17 @@ class ParamDecl : public VarDecl {
55385544 TypeRepr *getTypeRepr () const { return TyRepr; }
55395545 void setTypeRepr (TypeRepr *repr) { TyRepr = repr; }
55405546
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+ }
55435558
55445559 DefaultArgumentKind getDefaultArgumentKind () const {
55455560 return static_cast <DefaultArgumentKind>(Bits.ParamDecl .defaultArgumentKind );
@@ -5671,13 +5686,15 @@ class ParamDecl : public VarDecl {
56715686
56725687 // / Whether or not this parameter is marked with '_const'.
56735688 bool isCompileTimeConst () const {
5674- return DefaultValueAndFlags.getInt ().contains (Flags::IsCompileTimeConst);
5689+ return ArgumentNameAndFlags.getInt ().contains (
5690+ ArgumentNameFlags::IsCompileTimeConst);
56755691 }
56765692
56775693 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);
56815698 }
56825699
56835700 // / Does this parameter reject temporary pointer conversions?
0 commit comments