@@ -25,11 +25,6 @@ using namespace ento;
25
25
26
26
namespace {
27
27
28
- bool stringEndsWith (const std::string &str, const std::string &suffix) {
29
- auto index = str.rfind (suffix);
30
- return index != std::string::npos && str.size () - suffix.size () == index;
31
- }
32
-
33
28
class UncountedCallArgsChecker
34
29
: public Checker<check::ASTDecl<TranslationUnitDecl>> {
35
30
BugType Bug{this ,
@@ -217,17 +212,18 @@ class UncountedCallArgsChecker
217
212
if (!NsDecl || !isa<NamespaceDecl>(NsDecl))
218
213
return false ;
219
214
220
- auto methodName = safeGetName (Decl);
221
- auto clsName = safeGetName (ClassDecl);
222
- auto nsName = safeGetName (NsDecl);
215
+ auto MethodName = safeGetName (Decl);
216
+ auto ClsNameStr = safeGetName (ClassDecl);
217
+ StringRef ClsName = ClsNameStr; // FIXME: Make safeGetName return StringRef.
218
+ auto NamespaceName = safeGetName (NsDecl);
223
219
// FIXME: These should be implemented via attributes.
224
- return nsName == " WTF" &&
225
- (methodName == " find" || methodName == " findIf" ||
226
- methodName == " reverseFind" || methodName == " reverseFindIf" ||
227
- methodName == " get" || methodName == " inlineGet" ||
228
- methodName == " contains" || methodName == " containsIf" ) &&
229
- (stringEndsWith (clsName, " Vector" ) ||
230
- stringEndsWith (clsName, " Set " ) || stringEndsWith (clsName, " Map" ));
220
+ return NamespaceName == " WTF" &&
221
+ (MethodName == " find" || MethodName == " findIf" ||
222
+ MethodName == " reverseFind" || MethodName == " reverseFindIf" ||
223
+ MethodName == " get" || MethodName == " inlineGet" ||
224
+ MethodName == " contains" || MethodName == " containsIf" ) &&
225
+ (ClsName. ends_with ( " Vector" ) || ClsName. ends_with ( " Set " ) ||
226
+ ClsName. ends_with ( " Map" ));
231
227
}
232
228
233
229
void reportBug (const Expr *CallArg, const ParmVarDecl *Param) const {
0 commit comments