[clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stl
authorAlexander Kornienko <alexfh@google.com>
Thu, 10 Sep 2015 16:37:46 +0000 (16:37 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 10 Sep 2015 16:37:46 +0000 (16:37 +0000)
commit7532d3e93d3980d628f10c63c2bc97bca2e7c2c1
tree39a8b5ff46f69b31cdaacdf4b95512a9a63bd93c
parente3b1f2b7658ea22b13d6bae34f5ac4c9f4dc8fc6
[clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stl
containers.

Summary:
sizeof(some_std_string) is likely to be an error. This check finds this
pattern and suggests using .size() instead.

Reviewers: djasper, klimek, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Differential Revision: http://reviews.llvm.org/D12759

llvm-svn: 247297
clang-tools-extra/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/clang-tidy/misc/SizeofContainerCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/misc/SizeofContainerCheck.h [new file with mode: 0644]
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/docs/clang-tidy/checks/misc-sizeof-container.rst [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/misc-sizeof-container.cpp [new file with mode: 0644]