FixIt idea: memset(buf, sizeof(buf), fill_val) => memset(buf, fill_val, sizeof(buf))

Howdy,

I just found myself making the mistake mentioned in the subject. No
warnings, even with -Weverything. The fixit would recognize a sizeof()
in the fill value position and suggest the swap.

Does anyone think this would be a useful fixit? I'd like to take a
stab at implementing it if it wouldn't be too hard for a Clang
beginner.

Cheers,
Jevin

I think there is a general case where you have:

- A function that takes a buffer and a size as arguments
- A parameter pair that is a buffer and the size of that buffer
- The size not being the size of the buffer.

It would be great to have this warning for the general case. I think there's an attribute that lets you mark a parameter as the size of another, but we could treat things like memset() as special cases if they lack this attribute.

David