[PATCH] D69560: [clang-tidy] Add 'bugprone-easily-swappable-parameters' check

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 01:18:15 PST 2021


whisperity added a comment.

In D69560#2549959 <https://reviews.llvm.org/D69560#2549959>, @steveire wrote:

> Why "easily" instead of "suspicious", "spuriously" or any of the other words that are already used?

The name was @aaron.ballman's idea after we postponed the `experimental-cppcoreguidelines-yaddayaddayadda...`.
The best I could come up with is `potentially`. The `suspicious` is a problem because this check is an interface check, not a call-site check. (The sister check is currently called `suspiciously-swapped-argument` or something like that.)

The original check idea from C++ Core Guidelines <http://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-unrelated> also uses the phrase:

> Reason: Adjacent arguments of the same type are easily swapped by mistake.

However, `potentially-swappable-parameters` just sounds... wonky. It does not carry the weight the rule otherwise meant to.
`weakly-typed-parameters`?

I am not good with names, sadly.

----

I am conflicted about saying that "easily" **always** refers to some "positive aspect", however. Use a [[unnamed trademarked safety device]] because you can end up easily cutting off your finger during work. Do not touch a stove/hot water fountain, because you can easily get burnt. Leaving Christmas candles unattended could easily lead to a house fire. Does anyone want to get hurt, burnt, their house destroyed, etc.? There is nothing "positive" in these suggestions or regulations either. And we are doing a tool that is practically the same thing, trying to prevent a (different kind of) fire.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69560/new/

https://reviews.llvm.org/D69560



More information about the cfe-commits mailing list