[all-commits] [llvm/llvm-project] f7b713: [clang-tidy] Make `readability-container-data-poin...
FabianWolff via All-commits
all-commits at lists.llvm.org
Tue Jan 18 12:11:28 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f7b7138a62648f4019c55e4671682af1f851f295
https://github.com/llvm/llvm-project/commit/f7b7138a62648f4019c55e4671682af1f851f295
Author: Fabian Wolff <fabian.wolff at alumni.ethz.ch>
Date: 2022-01-18 (Tue, 18 Jan 2022)
Changed paths:
M clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.cpp
M clang-tools-extra/test/clang-tidy/checkers/readability-container-data-pointer.cpp
Log Message:
-----------
[clang-tidy] Make `readability-container-data-pointer` more robust
Fixes PR#52245. I've also added a few test cases beyond PR#52245 that would also fail with the current implementation, which is quite brittle in many respects (e.g. it uses the `hasDescendant()` matcher to find the container that is being accessed, which is very easy to trick, as in the example in PR#52245).
I have not been able to reproduce the second issue mentioned in PR#52245 (namely that using the `data()` member function is suggested even for containers that don't have it), but I've added a test case for it to be sure.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D113863
More information about the All-commits
mailing list