Prazek added a comment. Good job. I think it is resonable to warn in cases like:
if (str.compare(str2) == 1) or even if(str.compare(str2) == -1) Sometimes people check for 1 or -1 instead of > 0 and < 0. If I remember corectly PVS studio found some bugs like this. ================ Comment at: clang-tidy/misc/StringCompareCheck.cpp:27 + hasName("::std::basic_string"))))), + hasArgument(0, declRefExpr()), callee(memberExpr())); + ---------------- malcolm.parsons wrote: > I don't think you need to check what the first argument is. +1, just check if you are calling function with 1 argument. you can still use hasArgument(0, expr().bind("str2")) to bind argument ================ Comment at: clang-tidy/misc/StringCompareCheck.cpp:25 + return; + const auto strCompare = cxxMemberCallExpr( + callee(cxxMethodDecl(hasName("compare"), ---------------- Start with upper case https://reviews.llvm.org/D27210 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits