[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with mixability because...
authorWhisperity <whisperity@gmail.com>
Tue, 17 Dec 2019 17:00:08 +0000 (18:00 +0100)
committerWhisperity <whisperity@gmail.com>
Mon, 28 Jun 2021 08:49:37 +0000 (10:49 +0200)
commite33d0478831e4a295cb136ce1f58587155309fa2
tree263af3a43037960ebfe60320f232dbfb6b0f06ff
parent961e9e6af65ef097678c57fe5f1c18b825eb723f
[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with mixability because of implicit conversions

Adds a relaxation option ModelImplicitConversions which will make the check
report for cases where parameters refer to types that are implicitly
convertible to one another.

Example:

    struct IntBox { IntBox(int); operator int(); };
    void foo(int i, double d, IntBox ib) {}

Implicit conversions are the last to model in the set of things that are
reasons for the possibility of a function being called the wrong way which is
not always immediately apparent when looking at the function (signature or
call).

Reviewed By: aaron.ballman, martong

Differential Revision: http://reviews.llvm.org/D75041
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.h
clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-ignore.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicit-qualifiers.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicits.c [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicits.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-len2.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-len3.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-qualifiermixing.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters.c