madsravn added inline comments.
================ Comment at: clang-tidy/misc/StringCompareCheck.cpp:37 + hasArgument(0, expr().bind("str2")), argumentCountIs(1), + callee(memberExpr(has(implicitCastExpr(anyOf( + has(callExpr(has(implicitCastExpr(has(declRefExpr())))).bind("str1")), ---------------- malcolm.parsons wrote: > Do you really care what the callee expression is? > Use `isArrow()` on the `MemberExpr` to check if it's a pointer. How else would I get str1? Using the below snippet, I only get str1.compare and str1->compare instead of str1. Given a MemberExpr (str1.compare) is there an easy way to extract str1? ``` const auto StrCompare = cxxMemberCallExpr( callee(cxxMethodDecl(hasName("compare"), ofClass(classTemplateSpecializationDecl( hasName("::std::basic_string"))))), hasArgument(0, expr().bind("str2")), argumentCountIs(1), callee(memberExpr().bind("str1"))) ``` https://reviews.llvm.org/D27210 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits