diff options
Diffstat (limited to 'test/clang-tidy')
-rw-r--r-- | test/clang-tidy/readability-container-size-empty.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test/clang-tidy/readability-container-size-empty.cpp b/test/clang-tidy/readability-container-size-empty.cpp index 7fcfb500..eb453fcb 100644 --- a/test/clang-tidy/readability-container-size-empty.cpp +++ b/test/clang-tidy/readability-container-size-empty.cpp @@ -2,17 +2,32 @@ namespace std { template <typename T> struct vector { - vector() {} + vector(); + unsigned long size() const; + bool empty() const; +}; + +inline namespace __v2 { +template <typename T> struct set { + set(); unsigned long size() const; bool empty() const; }; } + +} + int main() { + std::set<int> intSet; + if (intSet.size() == 0) + ; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty] + // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}} std::vector<int> vect; if (vect.size() == 0) ; - // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty] + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used // CHECK-FIXES: {{^ }}if (vect.empty()){{$}} if (vect.size() != 0) ; |