summaryrefslogtreecommitdiff
path: root/clang-tools-extra/test
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2018-11-27 10:53:38 +0000
committerAlexander Kornienko <alexfh@google.com>2018-11-27 10:53:38 +0000
commit4811bde74c8bf7a3cc38dbdd3db3890a5cac7dee (patch)
tree38ce01b390c9390d909337cec977346db739c9fa /clang-tools-extra/test
parent5191b3079121b8988e495033bd4b156f3e716ef3 (diff)
[clang-tidy] Minor fixes in a test
Use CHECK-FIXES where it was intended instead of CHECK-MESSAGES. Fixed compiler warnings to pacify YouCompleteMe.
Diffstat (limited to 'clang-tools-extra/test')
-rw-r--r--clang-tools-extra/test/clang-tidy/readability-container-size-empty.cpp16
1 files changed, 8 insertions, 8 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 3c3c9a6a423..65d5c8ebdc4 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
@@ -105,10 +105,10 @@ int main() {
std::string str;
std::string str2;
std::wstring wstr;
- str.size() + 0;
- str.size() - 0;
- 0 + str.size();
- 0 - str.size();
+ (void)(str.size() + 0);
+ (void)(str.size() - 0);
+ (void)(0 + str.size());
+ (void)(0 - str.size());
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]
@@ -399,8 +399,8 @@ int main() {
// CHECK-FIXES: {{^ }}if (derived.empty()){{$}}
}
-#define CHECKSIZE(x) if (x.size())
-// CHECK-FIXES: #define CHECKSIZE(x) if (x.size())
+#define CHECKSIZE(x) if (x.size()) {}
+// CHECK-FIXES: #define CHECKSIZE(x) if (x.size()) {}
template <typename T> void f() {
std::vector<T> v;
@@ -415,7 +415,7 @@ template <typename T> void f() {
// CHECK-FIXES-NEXT: ;
CHECKSIZE(v);
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: the 'empty' method should be used
- // CHECK-MESSAGES: CHECKSIZE(v);
+ // CHECK-FIXES: CHECKSIZE(v);
TemplatedContainer<T> templated_container;
if (templated_container.size())
@@ -429,7 +429,7 @@ template <typename T> void f() {
// CHECK-FIXES-NEXT: ;
CHECKSIZE(templated_container);
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: the 'empty' method should be used
- // CHECK-MESSAGES: CHECKSIZE(templated_container);
+ // CHECK-FIXES: CHECKSIZE(templated_container);
}
void g() {