[PATCH] D106946: [clang-tidy] Fix crash on "reference to array" parameters in 'bugprone-easily-swappable-parameters'

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 28 05:31:11 PDT 2021


whisperity added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicits.cpp:46
+
+void crefToArrayTypedefBoth1(const Point2D &VecDescartes, const Point3D &VecThreeD) {}
+// NO-WARN: Distinct types.
----------------
aaron.ballman wrote:
> Can you also add a test case like:
> ```
> template <int N, int M>
> void func(int (&array1)[N], int (&array2)[M]) {}
> 
> void instantiate() {
>   int foo[12], bar[12];
>   func(foo, bar);
> 
>   int baz[12], quux[42];
>   func(baz, quux);
> }
> ```
(Implicitly) instantiated decls are excluded from the check as a whole, so this test case will not drive the check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106946



More information about the cfe-commits mailing list