llvm/clang-tools-extra
Fabian Wolff f7b7138a62 [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
2022-01-18 21:08:59 +01:00
..
clang-apply-replacements [clang-apply-replacements] Correctly handle relative paths 2021-11-11 18:28:43 +00:00
clang-change-namespace
clang-doc Revert "[cmake] Use GNUInstallDirs to support custom installation dirs." 2022-01-16 05:48:30 +00:00
clang-include-fixer Revert "[cmake] Use GNUInstallDirs to support custom installation dirs." 2022-01-16 05:48:30 +00:00
clang-move
clang-query
clang-reorder-fields
clang-tidy [clang-tidy] Make readability-container-data-pointer more robust 2022-01-18 21:08:59 +01:00
clangd [clangd][clang-tidy] Remove uses of std::vector<bool> 2022-01-18 17:59:40 +01:00
docs [clang-tidy] Fix false positives involving type aliases in misc-unconventional-assign-operator check 2022-01-17 21:16:17 +01:00
modularize Revert "[cmake] Use GNUInstallDirs to support custom installation dirs." 2022-01-16 05:48:30 +00:00
pp-trace
test [clang-tidy] Make readability-container-data-pointer more robust 2022-01-18 21:08:59 +01:00
tool-template
unittests [clang-tidy][NFC] Move CachedGlobList to GlobList.h 2021-12-04 08:50:49 +00:00
.gitignore
CMakeLists.txt Revert "[cmake] Use GNUInstallDirs to support custom installation dirs." 2022-01-16 05:48:30 +00:00
CODE_OWNERS.TXT
LICENSE.TXT
README.txt

//===----------------------------------------------------------------------===//
// Clang Tools repository
//===----------------------------------------------------------------------===//

Welcome to the repository of extra Clang Tools.  This repository holds tools
that are developed as part of the LLVM compiler infrastructure project and the
Clang frontend.  These tools are kept in a separate "extra" repository to
allow lighter weight checkouts of the core Clang codebase.

This repository is only intended to be checked out inside of a full LLVM+Clang
tree, and in the 'tools/extra' subdirectory of the Clang checkout.

All discussion regarding Clang, Clang-based tools, and code in this repository
should be held using the standard Clang mailing lists:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

Code review for this tree should take place on the standard Clang patch and
commit lists:
  http://lists.llvm.org/mailman/listinfo/cfe-commits

If you find a bug in these tools, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/