forked from mirrors/gecko-dev
Differential Revision: https://phabricator.services.mozilla.com/D3980 --HG-- rename : tools/clang-tidy/test/misc-bool-pointer-implicit-conversion.cpp => tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp rename : tools/clang-tidy/test/misc-forward-declaration-namespace.cpp => tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp rename : tools/clang-tidy/test/misc-macro-repeated-side-effects.cpp => tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp rename : tools/clang-tidy/test/misc-string-constructor.cpp => tools/clang-tidy/test/bugprone-string-constructor.cpp rename : tools/clang-tidy/test/misc-string-integer-assignment.cpp => tools/clang-tidy/test/bugprone-string-integer-assignment.cpp rename : tools/clang-tidy/test/misc-suspicious-missing-comma.cpp => tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp rename : tools/clang-tidy/test/misc-swapped-arguments.cpp => tools/clang-tidy/test/bugprone-swapped-arguments.cpp rename : tools/clang-tidy/test/misc-unused-raii.cpp => tools/clang-tidy/test/bugprone-unused-raii.cpp extra : moz-landing-system : lando
26 lines
633 B
C++
26 lines
633 B
C++
// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-swapped-arguments.html
|
|
|
|
void test_d_i(double d, int i);
|
|
void test_d_i_i(double d, int i, int ii);
|
|
void test_i_d(int i, double d);
|
|
void test_i_i_d(int i, int ii, double d);
|
|
|
|
void test()
|
|
{
|
|
double d = 1;
|
|
int i = 1;
|
|
|
|
test_d_i(d, i); // OK
|
|
test_d_i(i, d); // WARNING
|
|
|
|
test_i_d(i, d); // OK
|
|
test_i_d(d, i); // WARNING
|
|
|
|
test_i_i_d(i, i, d); // OK
|
|
test_i_i_d(i, d, i); // WARNING
|
|
test_i_i_d(d, i, i); // NO WARNING after second parameter
|
|
|
|
test_d_i_i(d, i, i); // OK
|
|
test_d_i_i(i, d, i); // WARNING
|
|
test_d_i_i(i, i, d); // NO WARNING after second parameter
|
|
}
|