[PATCH] D27210: [clang-tidy] misc-string-compare. Adding a new check to clang-tidy

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 08:03:01 PST 2016


malcolm.parsons added a comment.

I think you could add fixits for this.



================
Comment at: clang-tidy/misc/MiscStringCompareCheck.cpp:48
+  Finder->addMatcher(ifStmt(hasCondition(binaryOperator(hasOperatorName("=="),
+                                                        hasLHS(strCompare))))
+                         .bind("match"),
----------------
Doesn't test RHS.


================
Comment at: clang-tidy/misc/MiscStringCompareCheck.cpp:54
+  Finder->addMatcher(ifStmt(hasCondition(binaryOperator(hasOperatorName("!="),
+                                                        hasLHS(strCompare))))
+                         .bind("match"),
----------------
Doesn't test RHS.
Could be combined with the previous case.


================
Comment at: clang-tidy/misc/MiscStringCompareCheck.h:24
+/// http://clang.llvm.org/extra/clang-tidy/checks/misc-string-compare-check.html
+class MiscStringCompareCheck : public ClangTidyCheck {
+public:
----------------
Remove `Misc`.

Did you use add_new_check.py to add this check?


================
Comment at: docs/clang-tidy/checks/misc-string-compare.rst:4
+misc-string-compare
+=======================
+
----------------
Too many `=`.


Repository:
  rL LLVM

https://reviews.llvm.org/D27210





More information about the cfe-commits mailing list