#include "UseRangesCheck.h"
#include "Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchersInternal.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <optional>
#include <string>
usingnamespaceclang::ast_matchers;
static constexpr const char BoundCall[] = …;
static constexpr const char FuncDecl[] = …;
static constexpr const char ArgName[] = …;
namespace clang::tidy::utils {
static std::string getFullPrefix(ArrayRef<UseRangesCheck::Indexes> Signature) { … }
namespace {
AST_MATCHER(Expr, hasSideEffects) { … }
}
static auto
makeExprMatcher(ast_matchers::internal::Matcher<Expr> ArgumentMatcher,
ArrayRef<StringRef> MethodNames,
ArrayRef<StringRef> FreeNames) { … }
static ast_matchers::internal::Matcher<CallExpr>
makeMatcherPair(StringRef State, const UseRangesCheck::Indexes &Indexes,
ArrayRef<StringRef> BeginFreeNames,
ArrayRef<StringRef> EndFreeNames,
const std::optional<UseRangesCheck::ReverseIteratorDescriptor>
&ReverseDescriptor) { … }
void UseRangesCheck::registerMatchers(MatchFinder *Finder) { … }
static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call,
ArrayRef<unsigned> Indexes,
const ASTContext &Ctx) { … }
void UseRangesCheck::check(const MatchFinder::MatchResult &Result) { … }
bool UseRangesCheck::isLanguageVersionSupported(
const LangOptions &LangOpts) const { … }
UseRangesCheck::UseRangesCheck(StringRef Name, ClangTidyContext *Context)
: … { … }
void UseRangesCheck::registerPPCallbacks(const SourceManager &,
Preprocessor *PP, Preprocessor *) { … }
void UseRangesCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
std::optional<std::string>
UseRangesCheck::Replacer::getHeaderInclusion(const NamedDecl &) const { … }
DiagnosticBuilder UseRangesCheck::createDiag(const CallExpr &Call) { … }
std::optional<UseRangesCheck::ReverseIteratorDescriptor>
UseRangesCheck::getReverseDescriptor() const { … }
ArrayRef<std::pair<StringRef, StringRef>>
UseRangesCheck::getFreeBeginEndMethods() const { … }
std::optional<TraversalKind> UseRangesCheck::getCheckTraversalKind() const { … }
}