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
[clang-tidy] Fix false-positives in readability-container-size-empty (llvm#74140)
Added support for size-like method returning signed type, and corrected
false positive caused by always-false check for size bellow zero.
Closesllvm#72619
// CHECK-MESSAGES: :[[@LINE-2]]:9: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
838
+
// CHECK-FIXES: {{^ }}if (s.empty()){{$}}
839
+
if (1 > s.size())
840
+
;
841
+
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
842
+
// CHECK-FIXES: {{^ }}if (s.empty()){{$}}
843
+
if (s.size() <= 0)
844
+
;
845
+
// CHECK-MESSAGES: :[[@LINE-2]]:9: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
846
+
// CHECK-FIXES: {{^ }}if (s.empty()){{$}}
847
+
if (0 >= s.size())
848
+
;
849
+
// CHECK-MESSAGES: :[[@LINE-2]]:14: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
0 commit comments