diff options
| author | Alexander Kornienko <alexfh@google.com> | 2016-12-21 23:44:23 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2016-12-21 23:44:23 +0000 |
| commit | b5ca17f817c066766424a91c2eed97ba4d52eba2 (patch) | |
| tree | d761f76e9e44b61df69cbdafc0b72c11764bb077 /clang-tools-extra/clang-tidy/readability | |
| parent | ec9ebba778aa3c2c8a3e78121da5ce9b77319227 (diff) | |
| download | bcm5719-llvm-b5ca17f817c066766424a91c2eed97ba4d52eba2.tar.gz bcm5719-llvm-b5ca17f817c066766424a91c2eed97ba4d52eba2.zip | |
[clang-tidy] Ignore `size() == 0` in the container implementation.
llvm-svn: 290289
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability')
| -rw-r--r-- | clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp index 79e4061c8c3..665d1dbe349 100644 --- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp @@ -58,7 +58,9 @@ void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) { hasType(pointsTo(ValidContainer)), hasType(references(ValidContainer)))) .bind("STLObject")), - callee(cxxMethodDecl(hasName("size"))), WrongUse) + callee(cxxMethodDecl(hasName("size"))), WrongUse, + unless(hasAncestor(cxxMethodDecl( + ofClass(equalsBoundNode("container")))))) .bind("SizeCallExpr"), this); } |

