================ @@ -0,0 +1,109 @@ +//===--- UseStartsEndsWithCheck.cpp - clang-tidy --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "UseStartsEndsWithCheck.h" + +#include "../utils/OptionsUtils.h" +#include "clang/Lex/Lexer.h" + +#include <string> + +using namespace clang::ast_matchers; + +namespace clang::tidy::performance { + +UseStartsEndsWithCheck::UseStartsEndsWithCheck(StringRef Name, + ClangTidyContext *Context) + : ClangTidyCheck(Name, Context) {} + +void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) { + const auto ZeroLiteral = integerLiteral(equals(0)); + const auto HasStartsWithMethod = anyOf( + hasMethod(cxxMethodDecl(hasName("starts_with")).bind("starts_with_fun")), + hasMethod(cxxMethodDecl(hasName("startsWith")).bind("starts_with_fun")), + hasMethod(cxxMethodDecl(hasName("startswith")).bind("starts_with_fun"))); ---------------- PiotrZSL wrote:
You may verify if those methods are also const. https://github.com/llvm/llvm-project/pull/72385 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits