malcolm.parsons added a comment.
Please run clang-format on all new files.
================
Comment at: test/clang-tidy/misc-string-compare.cpp:3
+
+#include <string>
+
----------------
clang-tidy tests don't #include system headers.
Declare the bits you need instead.
See test/clang-tidy/misc-string-constructor.cpp for an example.
================
Comment at: test/clang-tidy/misc-string-compare.cpp:9
+
+ if(str1.compare(str2)) {}
+ // CHECK-MESSAGES: [[@LINE-1]]:3: warning: do not use compare to test
equality of strings; use the string equality operator instead
[misc-string-compare]
----------------
Some other test ideas:
```
if (str1.compare("foo")) {}
return str1.compare(str2) == 0;
func(str1.compare(str2) != 0);
if (str2.empty() || str1.compare(str2) != 0) {}
```
https://reviews.llvm.org/D27210
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits