[PATCH] D117090: [clang-tidy] Fix `readability-non-const-parameter` for parameter referenced by an lvalue

gehry via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 18:56:55 PST 2022


Sockke added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-non-const-parameter.cpp:293
+  // CHECK-MESSAGES-NOT: warning: pointer parameter 'p' can be
+  int &x = *p;
+}
----------------
MTC wrote:
> @Sockke  Could you please add the following tests?
> 
> ```
> int &ref = std::ref(*p);
> const int &cref = std::ref(*p);
> const int &cref = std::cref(*p);
> const int *ptr = std::as_const(p);
> int *ptr = const_cast<int*>(std::as_const(p));
> decltype(auto) ptr = p;
> auto ptr = p;
> ```
These cases have been handled stably in another logic.


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

https://reviews.llvm.org/D117090



More information about the cfe-commits mailing list