Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-13 Thread Kirill Bobyrev via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL281307: [clang-tidy] Extend readability-container-size-empty to arbitrary class with… (authored by omtcyfz). Changed prior to commit: https://reviews.llvm.org/D24349?vs=71119=71120#toc Repository:

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-13 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 71119. omtcyfz marked an inline comment as done. omtcyfz added a comment. Combine two `returns` matchers. https://reviews.llvm.org/D24349 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-13 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. LG Comment at: clang-tidy/readability/ContainerSizeEmptyCheck.cpp:35 @@ +34,3 @@ + hasName("size"), returns(isInteger()), +

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-12 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 70989. omtcyfz added a comment. Messed up with the last diff; fix that + clang-format the check. https://reviews.llvm.org/D24349 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp docs/clang-tidy/checks/readability-container-size-empty.rst

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-12 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 70986. omtcyfz marked 4 inline comments as done. omtcyfz added a comment. Address another round of comments. https://reviews.llvm.org/D24349 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-12 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision. alexfh added a comment. This revision now requires changes to proceed. In https://reviews.llvm.org/D24349#538102, @aaron.ballman wrote: > In https://reviews.llvm.org/D24349#538098, @alexfh wrote: > > > Thank you for the patch! > > > > In

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-09 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 70822. omtcyfz added a comment. Allow inheritance for `size()` and `empty()`. https://reviews.llvm.org/D24349 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp docs/clang-tidy/checks/readability-container-size-empty.rst

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-09 Thread Kirill Bobyrev via cfe-commits
omtcyfz removed rL LLVM as the repository for this revision. omtcyfz updated this revision to Diff 70818. omtcyfz added a comment. Restricted `size()` and `empty()` functions a little bit more. https://reviews.llvm.org/D24349 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-09 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D24349#538098, @alexfh wrote: > Thank you for the patch! > > In https://reviews.llvm.org/D24349#537500, @aaron.ballman wrote: > > > In https://reviews.llvm.org/D24349#537350, @Eugene.Zelenko wrote: > > > > > Probably check should have

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-09 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. Thank you for the patch! In https://reviews.llvm.org/D24349#537500, @aaron.ballman wrote: > In https://reviews.llvm.org/D24349#537350, @Eugene.Zelenko wrote: > > > Probably check should have options to extend list of containers and also to > > assume all classes with

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments. Comment at: clang-tidy/readability/ContainerSizeEmptyCheck.cpp:34 @@ +33,3 @@ + has(functionDecl( + isPublic(), hasName("size"), returns(isInteger()), + unless(anyOf(returns(isAnyCharacter()), returns(booleanType()),

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment. In https://reviews.llvm.org/D24349#537624, @aaron.ballman wrote: > I think that's reasonable, depending on whether we find false positives with > the warning as well (I have a slight concern about `size()` and `empty()` > being unrelated operations on a non-container

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D24349#537595, @xazax.hun wrote: > In https://reviews.llvm.org/D24349#537594, @omtcyfz wrote: > > > In https://reviews.llvm.org/D24349#537589, @Eugene.Zelenko wrote: > > > > > If size() and empty() change object's state, it may be not

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment. In https://reviews.llvm.org/D24349#537594, @omtcyfz wrote: > In https://reviews.llvm.org/D24349#537589, @Eugene.Zelenko wrote: > > > If size() and empty() change object's state, it may be not equivalent > > replacement. > > > True. But my point is that they are not

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment. In https://reviews.llvm.org/D24349#537589, @Eugene.Zelenko wrote: > If size() and empty() change object's state, it may be not equivalent > replacement. True. But my point is that they are not required to do that if they're just not marked `const`. Repository: rL

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment. If size() and empty() change object's state, it may be not equivalent replacement. Repository: rL LLVM https://reviews.llvm.org/D24349 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Kirill Bobyrev via cfe-commits
omtcyfz marked an inline comment as done. omtcyfz added a comment. In https://reviews.llvm.org/D24349#537350, @Eugene.Zelenko wrote: > Probably check should have options to extend list of containers and also to > assume all classes with integer type size() const and bool empty() const as >

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D24349#537549, @Eugene.Zelenko wrote: > Should we also check for absence of parameters in size() and empty() as well > as const? I think that would be reasonable. https://reviews.llvm.org/D24349

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment. Should we also check for absence of parameters in size() and empty() as well as const? https://reviews.llvm.org/D24349 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D24349#537350, @Eugene.Zelenko wrote: > Probably check should have options to extend list of containers and also to > assume all classes with integer type size() const and bool empty() const as > containers. It may be not trivial to

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment. Probably check should have options to extend list of containers and also to assume all classes with integer type size() const and bool empty() const as containers. It may be not trivial to find out all custom containers and last option will be helpful to

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Kirill Bobyrev via cfe-commits
omtcyfz marked an inline comment as done. Comment at: clang-tidy/readability/ContainerSizeEmptyCheck.cpp:33 @@ +32,3 @@ + const auto validContainer = namedDecl( + has(functionDecl( + isPublic(), hasName("size"), returns(isInteger()), Thank you!

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 70717. omtcyfz added a comment. Blacklist `enum` and `bool` return types for `size()`. https://reviews.llvm.org/D24349 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp test/clang-tidy/readability-container-size-empty.cpp Index:

Re: [PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman. aaron.ballman added a reviewer: aaron.ballman. Comment at: clang-tidy/readability/ContainerSizeEmptyCheck.cpp:33 @@ +32,3 @@ + const auto validContainer = namedDecl( + has(functionDecl(isPublic(), hasName("size"),

[PATCH] D24349: [clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

2016-09-08 Thread Kirill Bobyrev via cfe-commits
omtcyfz created this revision. omtcyfz added reviewers: alexfh, Eugene.Zelenko, klimek. omtcyfz added a subscriber: cfe-commits. Implementing [[ https://llvm.org/bugs/show_bug.cgi?id=26823 | feature request ]]. This patch extends readability-container-size-empty check allowing it to produce