Fix a false positive case in ContainerSizeEmpty check (PR25893).
llvm-svn: 256142
diff --git a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
index 87ba314..c8f7bae 100644
--- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
@@ -126,6 +126,11 @@
(OpCode == BinaryOperatorKind::BO_LE && Value == 0 && !ContainerIsLHS))
return;
+ // Do not warn for size > 1, 1 < size.
+ if ((OpCode == BinaryOperatorKind::BO_GT && Value == 1 && ContainerIsLHS) ||
+ (OpCode == BinaryOperatorKind::BO_LT && Value == 1 && !ContainerIsLHS))
+ return;
+
if (OpCode == BinaryOperatorKind::BO_NE && Value == 0)
Negation = true;
if ((OpCode == BinaryOperatorKind::BO_GT ||