[clang-tidy] Extend readability-container-size-empty to arbitrary class with size...
authorKirill Bobyrev <omtcyfz@gmail.com>
Tue, 13 Sep 2016 08:58:11 +0000 (08:58 +0000)
committerKirill Bobyrev <omtcyfz@gmail.com>
Tue, 13 Sep 2016 08:58:11 +0000 (08:58 +0000)
commitacb6b35b566e6558cef7bfc1d3c19943786c01c9
tree5fe82e4c6009edcae845c0b891f26deaeb25991b
parent520a18df9ca30e4cacdb4cbfa79fa18b70b724db
[clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

This patch extends readability-container-size-empty check allowing it to produce
warnings not only for STL containers, but also for containers, which provide two
functions matching following signatures:

* `size_type size() const;`
* `bool empty() const;`

Where `size_type` can be any kind of integer type.

This functionality was proposed in https://llvm.org/bugs/show_bug.cgi?id=26823
by Eugene Zelenko.

Approval: alexfh

Reviewers: alexfh, aaron.ballman, Eugene.Zelenko

Subscribers: etienneb, Prazek, hokein, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D24349

llvm-svn: 281307
clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
clang-tools-extra/docs/clang-tidy/checks/readability-container-size-empty.rst
clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp