For a function F whose parameters need to be fixed, we group fix-its of its' parameters together so that either all of the parameters get fixed or none of them gets fixed.
The reason for doing so is to avoid generating low-quality fix-its. For example,
void f(int * p, int * q) { int i = p[5]; int j = q[5]; }
We would like to fix both parameters p and q with std::span. If we do not group them together, they will be fixed in two steps: 1) fixing p first; and then 2) fixing q. Step 1 yields a new overload of f:
void f(std::span<int> p, int *q) { ... } [[unsafe_buffer_usage]] void f(int *p, int *q) {return f(std::span(p, <# size #>), q);} }
The new overload of f is, however, still an unsafe function. Then we apply step 2 and have:
void f(std::span<int> p, std::span<int> q) { ... } [[unsafe_buffer_usage]] void f(int *p, int *q) {return f(std::span<int>(p, <# size #>), q);} [[unsafe_buffer_usage]] void f(std::span<int> p, int *q) {return f(p, std::span<int>(q, <# size #>));}
The "intermediate" overload void f(std::span<int>, int *) stays there but usually is not useful. If there are more than two parameters need to be fixed, there will be more such useless "intermediate" overloads.
With this patch, p and q will be fixed together: either selecting p or q to fix will result in a safe function void f(std::span<int> p, std::span<int> q in one step.
Formatting is a bit off (clang-format probably needed some human help here).