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

Niels Dekker via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 15:49:13 PST 2024


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 <N.Dekker at lumc.nl>
Date: Tue, 3 Dec 2024 11:02:59 +0100
Subject: [PATCH] [clang-tidy] Sync ContainerSizeEmptyCheck with
 container-size-empty doc

Brought the class documentation in sync with the user documentation at
clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
---
 .../clang-tidy/readability/ContainerSizeEmptyCheck.h     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
index acd8a6bfc50f5e..3aa4bdc496194b 100644
--- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
@@ -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 may implement the `empty()` method but not
-/// implement the `size()` method. Using `empty()` whenever possible makes it
-/// easier to switch to another container in the future.
+/// instead of the `size()`/`length()` method. It shows clearer intent to use
+/// `empty()`. Furthermore some containers may implement the `empty()` method
+/// but not implement the `size()` or `length()` method. Using `empty()`
+/// whenever possible makes it easier to switch to another container in the
+/// future.
 class ContainerSizeEmptyCheck : public ClangTidyCheck {
 public:
   ContainerSizeEmptyCheck(StringRef Name, ClangTidyContext *Context);



More information about the cfe-commits mailing list