@@ -64,32 +64,32 @@ ParameterList *ParameterList::clone(const ASTContext &C,
6464 for (auto &decl : params) {
6565 auto defaultArgKind = decl->getDefaultArgumentKind ();
6666
67- decl = ParamDecl::cloneWithoutType (C, decl);
68- if (options & Implicit)
69- decl->setImplicit ();
70-
71- // If the argument isn't named, give the parameter a name so that
72- // silgen will produce a value for it.
73- if (decl->getName ().empty () && (options & NamedArguments)) {
74- llvm::SmallString<16 > s;
75- { llvm::raw_svector_ostream (s) << " __argument" << ++i; }
76- decl->setName (C.getIdentifier (s));
77- }
78-
7967 // If we're inheriting a default argument, mark it as such.
8068 // FIXME: Figure out how to clone default arguments as well.
8169 if (options & Inherited) {
8270 switch (defaultArgKind) {
8371 case DefaultArgumentKind::Normal:
8472 case DefaultArgumentKind::StoredProperty:
85- decl-> setDefaultArgumentKind ( DefaultArgumentKind::Inherited) ;
73+ defaultArgKind = DefaultArgumentKind::Inherited;
8674 break ;
8775
8876 default :
8977 break ;
9078 }
9179 } else {
92- decl->setDefaultArgumentKind (DefaultArgumentKind::None);
80+ defaultArgKind = DefaultArgumentKind::None;
81+ }
82+
83+ decl = ParamDecl::cloneWithoutType (C, decl, defaultArgKind);
84+ if (options & Implicit)
85+ decl->setImplicit ();
86+
87+ // If the argument isn't named, give the parameter a name so that
88+ // silgen will produce a value for it.
89+ if (decl->getName ().empty () && (options & NamedArguments)) {
90+ llvm::SmallString<16 > s;
91+ { llvm::raw_svector_ostream (s) << " __argument" << ++i; }
92+ decl->setName (C.getIdentifier (s));
9393 }
9494 }
9595
0 commit comments