@@ -527,15 +527,23 @@ static FuncDecl *createDistributedThunkFunction(FuncDecl *func) {
527
527
// --- Prepare parameters
528
528
auto funcParams = func->getParameters ();
529
529
SmallVector<ParamDecl*, 2 > paramDecls;
530
- for (auto i : indices (*func->getParameters ())) {
530
+ for (unsigned i : indices (*func->getParameters ())) {
531
531
auto funcParam = funcParams->get (i);
532
- auto paramDecl = new (C) ParamDecl (SourceLoc (),
533
- SourceLoc (), funcParam->getArgumentName (),
534
- SourceLoc (), funcParam->getParameterName (),
535
- DC);
532
+
533
+ auto paramName = funcParam->getParameterName ();
534
+ if (paramName.empty ()) {
535
+ paramName = C.getIdentifier (" p" + llvm::utostr (i));
536
+ }
537
+
538
+ auto paramDecl = new (C)
539
+ ParamDecl (SourceLoc (),
540
+ /* argumentNameLoc=*/ SourceLoc (), funcParam->getArgumentName (),
541
+ /* parameterNameLoc=*/ SourceLoc (), paramName, DC);
542
+
536
543
paramDecl->setImplicit (true );
537
544
paramDecl->setSpecifier (funcParam->getSpecifier ());
538
545
paramDecl->setInterfaceType (funcParam->getInterfaceType ());
546
+
539
547
paramDecls.push_back (paramDecl);
540
548
}
541
549
ParameterList *params = ParameterList::create (C, paramDecls); // = funcParams->clone(C);
0 commit comments