summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy')
-rw-r--r--clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp b/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp
index 7fcfb500a25..eb453fcbb09 100644
--- a/clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp
+++ b/clang-tools-extra/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)
;
OpenPOWER on IntegriCloud