[PATCH] D19577: [clang-tidy] Enhance misc-suspicious-string-compare by matching string.compare

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 27 04:21:19 PDT 2016


alexfh added a comment.

I'm somewhat reluctant to add LLVM-specific checks to misc-. I would prefer either to split the LLVM-specific part to a separate check in llvm/ (which might derive from this check or somehow reuse the logic) or make the check configurable enough so that these checks can be enabled for LLVM in the config file.


================
Comment at: clang-tidy/misc/SuspiciousStringCompareCheck.cpp:119
@@ +118,3 @@
+      cxxMemberCallExpr(
+          callee(cxxMethodDecl(hasAnyName("::llvm::StringRef::compare",
+                                          "::llvm::StringRef::compare_lower",
----------------
This is inconsistent with the code above. I'd also use `ofClass(hasName("::llvm::StringRef")), hasAnyName("compare", ...)`.


http://reviews.llvm.org/D19577





More information about the cfe-commits mailing list