[PATCH] D117090: [clang-tidy] Fix `readability-non-const-parameter` for parameter referenced by an lvalue
liushuai wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 23 19:05:02 PST 2022
MTC 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;
+}
----------------
Sockke wrote:
> 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.
Sorry for my mistake, look good to me!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117090/new/
https://reviews.llvm.org/D117090
More information about the cfe-commits
mailing list