[PATCH] D69560: [clang-tidy] Add 'experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type' check
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 8 09:08:27 PST 2021
whisperity added a comment.
In D69560#2487117 <https://reviews.llvm.org/D69560#2487117>, @aaron.ballman wrote:
> In D69560#2487093 <https://reviews.llvm.org/D69560#2487093>, @whisperity wrote:
>
>> Not sure what CVR-modelling's default should be... it finds less when "off", but too easily silences crucial issues (such as `memcpy(T*, const T*)`).
>
> My instinct is that if you accidentally swap a qualified parameter you'll get some other diagnostic about dropped qualifiers and so perhaps the default should be `off`, but perhaps there's something I'm not thinking of there.
That only happens if at a call site the //argument// is qualified.
void foo(const int& ir1, int& ir2);
void test() {
int i1 = 8;
int i2 = 10;
foo(i2, i1); // No warning here.
const int ci = 12;
foo(i1, ci); // Error here.
}
So while `const Something` and `Something` are distinct types conceptually (and as of now, according to I.24), an unqualified `Something` can still be passed in a swapped order at any given call site.
Will think about this.
I'll continue implementing some of the heuristics, re-run the measurements, and then I'll update the patch with the rename.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69560/new/
https://reviews.llvm.org/D69560
More information about the cfe-commits
mailing list