You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -861,3 +861,31 @@ namespace PR72619 {
861
861
if (0 >= s.size()) {}
862
862
}
863
863
}
864
+
865
+
namespacePR88203 {
866
+
structSS {
867
+
boolempty() const;
868
+
intsize() const;
869
+
intlength(int) const;
870
+
};
871
+
872
+
structSU {
873
+
boolempty() const;
874
+
intsize(int) const;
875
+
intlength() const;
876
+
};
877
+
878
+
voidf(const SS& s) {
879
+
if (0 == s.length(1)) {}
880
+
if (0 == s.size()) {}
881
+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
882
+
// CHECK-FIXES: {{^ }}if (s.empty()) {}{{$}}
883
+
}
884
+
885
+
voidf(const SU& s) {
886
+
if (0 == s.size(1)) {}
887
+
if (0 == s.length()) {}
888
+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: the 'empty' method should be used to check for emptiness instead of 'length' [readability-container-size-empty]
0 commit comments