[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-11-25 Thread Niels Dekker via cfe-commits
https://github.com/N-Dekker created https://github.com/llvm/llvm-project/pull/117629 >From C++11, a conforming `size()` method is guaranteed to be a constant-time >function. `empty()` is not _generally_ more efficient than `size()`. It might >even be implemented in terms of `size()`. No

[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-11-25 Thread Niels Dekker via cfe-commits
N-Dekker wrote: A personal note: yes, I like clang-tidy's readibility-container-size-empty check, I think it's great! And I do very much prefer `empty()` over `size()` "whenever possible". It's just that I think the claims in the documentation about efficiency and time complexity are no longer

[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-11-25 Thread Niels Dekker via cfe-commits
N-Dekker wrote: > You understand that this check does not apply only to std:: containers but > also to boost and other custom one that have size and empty methods. In such > case claim is still valid. Thanks for your prompt reply, Piotr. I thought of custom containers too, but then again, I w

[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-12-02 Thread Niels Dekker via cfe-commits
N-Dekker wrote: @PiotrZSL @HerrCai0907 Thank you both for your feedback and approval! Would one of you be able the merge the pull request? https://github.com/llvm/llvm-project/pull/117629 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang-tools-extra] [clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (PR #117629)

2024-11-26 Thread Niels Dekker via cfe-commits
N-Dekker wrote: Thanks for your encouragement, @HerrCai0907. I just [force-pushed](https://github.com/llvm/llvm-project/compare/87688f9ec5e74f9b3c74df05a69a4f822966b5f1..ab3009e825af5e323e749dfdbd2300ef68677f14), as you suggested. To further clarify my motivation, I believe that C++ users actu

[clang-tools-extra] [clang-tidy] Sync ContainerSizeEmptyCheck with container-size-empty doc (PR #118459)

2024-12-03 Thread Niels Dekker via cfe-commits
https://github.com/N-Dekker created https://github.com/llvm/llvm-project/pull/118459 Brought the class documentation in sync with the user documentation at container-size-empty.rst: https://github.com/llvm/llvm-project/blob/bfb26202e05ee2932b4368b5fca607df01e8247f/clang-tools-extra/docs/clang-

[clang-tools-extra] [clang-tidy] Sync ContainerSizeEmptyCheck with container-size-empty doc (PR #118459)

2024-12-04 Thread Niels Dekker via cfe-commits
@@ -18,10 +18,11 @@ namespace clang::tidy::readability { /// a call to `empty()`. /// /// The emptiness of a container should be checked using the `empty()` method -/// instead of the `size()` method. It shows clearer intent to use `empty()`. -/// Furthermore some containers ma

[clang-tools-extra] [clang-tidy] Sync ContainerSizeEmptyCheck with container-size-empty doc (PR #118459)

2024-12-19 Thread Niels Dekker via cfe-commits
N-Dekker wrote: @HerrCai0907 Thanks again for your approval, _and_ for merging my very first LLVM PR (#117629). Can you please 🙏 merge this one as well? https://github.com/llvm/llvm-project/pull/118459 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang-tools-extra] [clang-tidy] Mention std::forward_list in container-size-empty doc (PR #120701)

2024-12-20 Thread Niels Dekker via cfe-commits
https://github.com/N-Dekker created https://github.com/llvm/llvm-project/pull/120701 Mentioned `std::forward_list` as example of a container without `size()`. >From e58124c491f46238538bb06f14de31f4d5f25d2a Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 20 Dec 2024 10:30:54 +0100 Subjec

[clang-tools-extra] [clang-tidy] Mention std::forward_list in container-size-empty doc (PR #120701)

2024-12-20 Thread Niels Dekker via cfe-commits
https://github.com/N-Dekker ready_for_review https://github.com/llvm/llvm-project/pull/120701 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Sync ContainerSizeEmptyCheck with container-size-empty doc (PR #118459)

2024-12-03 Thread Niels Dekker via cfe-commits
https://github.com/N-Dekker updated https://github.com/llvm/llvm-project/pull/118459 >From 1e2cb1158f66fe5e1abff5cfe5a2134eed3a7f51 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 3 Dec 2024 11:02:59 +0100 Subject: [PATCH] [clang-tidy] Sync ContainerSizeEmptyCheck with container-size-em