summaryrefslogtreecommitdiff
path: root/test/clang-tidy
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2016-02-09 10:20:48 +0000
committerGabor Horvath <xazax.hun@gmail.com>2016-02-09 10:20:48 +0000
commit40d23fc8eb6804029bb5ac6f5f62a24e60f2ad8a (patch)
tree9b0c54fc223de5a21b41ebb64d6ff7052cb90f43 /test/clang-tidy
parentd1cdf89217ecf535567ca27897707cfccc752b05 (diff)
downloadclang-tools-extra-40d23fc8eb6804029bb5ac6f5f62a24e60f2ad8a.tar.gz
[clang-tidy] Make readability-container-size-empty work with inline namespaces. Fix PR25812.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@260217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/clang-tidy')
-rw-r--r--test/clang-tidy/readability-container-size-empty.cpp19
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)
;