The checker missed a check for a case when the parameter is referenced by an lvalue and this could cause build breakages.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp | ||
---|---|---|
86–99 | 86~99 is pretty close to 64~81, could you please refactor it? |
clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp | ||
---|---|---|
86–99 |
FunctionDecl and CXXConstructDecl have different methods with the same name. |
LGTM with some small nits, but can you also add a release note for the fix? (If there was a bug report for this issue, you should mention that report in the release note and close the bug out.)
clang-tools-extra/test/clang-tidy/checkers/readability-non-const-parameter.cpp | ||
---|---|---|
292 | Please spell out enough of the warning you don't expect to see (in all of these cases) so that someone reading the code knows what you expect to miss. |
clang-tools-extra/test/clang-tidy/checkers/readability-non-const-parameter.cpp | ||
---|---|---|
293 | @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; |
clang-tools-extra/test/clang-tidy/checkers/readability-non-const-parameter.cpp | ||
---|---|---|
293 | These cases have been handled stably in another logic. |
clang-tools-extra/test/clang-tidy/checkers/readability-non-const-parameter.cpp | ||
---|---|---|
293 | Sorry for my mistake, look good to me! |
Before landing make sure this is rebased against trunk, just so the pre-merge bot can run and verify there are no issues. It looks like this patch is based off a few commits that don't appear on trunk.
86~99 is pretty close to 64~81, could you please refactor it?