Skip to content

Commit

Permalink
[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with `type…
Browse files Browse the repository at this point in the history
…def` and `const &` diagnostics

The base patch only deals with strict (canonical) type equality, which is
merely a subset of all the dangerous function interfaces that we intend to
find.
In addition, in the base patch, canonical type equivalence is not diagnosed in
a way that is immediately apparent to the user.

This patch extends the check with two features:

 * Proper typedef diagnostics and explanations to the user.
 * "Reference bind power" matching.

Case 2 is a necessary addition because in every case someone encounters a
function `f(T t, const T& tr)`, any expression that might be passed to either
can be passed to both. Thus, such adjacent parameter sequences should be
matched.

Reviewed By: aaron.ballman

Differential Revision: http://reviews.llvm.org/D95736
  • Loading branch information
whisperity committed Jun 28, 2021
1 parent 499e39c commit 26d864b
Show file tree
Hide file tree
Showing 3 changed files with 443 additions and 39 deletions.

0 comments on commit 26d864b

Please sign in to comment.