Index: clang/lib/Analysis/UnsafeBufferUsage.cpp =================================================================== --- clang/lib/Analysis/UnsafeBufferUsage.cpp +++ clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -1886,8 +1886,11 @@ if (Parm->isImplicit()) continue; - assert(Parm->getIdentifier() && - "A parameter of a function definition has no name"); + // A parameter of a function definition has no name. + // FIXME: We should create a name for the parameter as part of the fix-it. + // Go through declarations of the function and look for a name? + if (!Parm->getIdentifier()) + return std::nullopt; if (i == ParmIdx) // This is our spanified paramter! SS << NewTypeText.str() << "(" << Parm->getIdentifier()->getName().str() << ", " Index: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp =================================================================== --- clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp +++ clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp @@ -156,4 +156,9 @@ if (++MyName){} } +// CHECK-NOT: fix-it:{{.*}}: +void parmHasNoName(int *p, int *) { // cannot fix the function because there is one parameter has no name. + p[5] = 5; +} + #endif