clang-tools 18.0.0git
Classes | Namespaces | Enumerations | Functions | Variables
LoopConvertCheck.cpp File Reference
#include "LoopConvertCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstring>
#include <optional>
#include <tuple>
#include <utility>

Go to the source code of this file.


struct  clang::tidy::OptionEnumMapping< modernize::Confidence::Level >
struct  clang::tidy::OptionEnumMapping< modernize::VariableNamer::NamingStyle >
struct  clang::tidy::modernize::ContainerCall


namespace  clang
 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
namespace  clang::tidy
namespace  clang::tidy::modernize


enum class  clang::tidy::modernize::IteratorCallKind { clang::tidy::modernize::ICK_Member , clang::tidy::modernize::ICK_ADL , clang::tidy::modernize::ICK_Std }


static StatementMatcher clang::tidy::modernize::integerComparisonMatcher ()
static DeclarationMatcher clang::tidy::modernize::initToZeroMatcher ()
static StatementMatcher clang::tidy::modernize::incrementVarMatcher ()
static StatementMatcher clang::tidy::modernize::arrayConditionMatcher (internal::Matcher< Expr > LimitExpr)
StatementMatcher clang::tidy::modernize::makeArrayLoopMatcher ()
 The matcher for loops over arrays.
StatementMatcher clang::tidy::modernize::makeIteratorLoopMatcher (bool IsReverse)
 The matcher used for iterator-based for loops.
StatementMatcher clang::tidy::modernize::makePseudoArrayLoopMatcher ()
 The matcher used for array-like containers (pseudoarrays).
static std::optional< ContainerCall > clang::tidy::modernize::getContainerExpr (const Expr *Call)
static std::pair< const Expr *, IteratorCallKind > clang::tidy::modernize::getContainerFromBeginEndCall (const Expr *Init, bool IsBegin, bool *IsArrow, bool IsReverse)
 Determine whether Init appears to be an initializing an iterator.
static const Expr * clang::tidy::modernize::findContainer (ASTContext *Context, const Expr *BeginExpr, const Expr *EndExpr, bool *ContainerNeedsDereference, bool IsReverse)
 Determines the container whose begin() and end() functions are called for an iterator-based loop.
static StringRef clang::tidy::modernize::getStringFromRange (SourceManager &SourceMgr, const LangOptions &LangOpts, SourceRange Range)
 Obtain the original source code text from a SourceRange.
static const ValueDecl * clang::tidy::modernize::getReferencedVariable (const Expr *E)
 If the given expression is actually a DeclRefExpr or a MemberExpr, find and return the underlying ValueDecl; otherwise, return NULL.
static bool clang::tidy::modernize::isDirectMemberExpr (const Expr *E)
 Returns true when the given expression is a member expression whose base is this (implicitly or not).
static bool clang::tidy::modernize::canBeModified (ASTContext *Context, const Expr *E)
 Given an expression that represents an usage of an element from the containter that we are iterating over, returns false when it can be guaranteed this element cannot be modified as a result of this usage.
static bool clang::tidy::modernize::usagesAreConst (ASTContext *Context, const UsageResult &Usages)
 Returns true when it can be guaranteed that the elements of the container are not being modified.
static bool clang::tidy::modernize::usagesReturnRValues (const UsageResult &Usages)
 Returns true if the elements of the container are never accessed by reference.
static bool clang::tidy::modernize::containerIsConst (const Expr *ContainerExpr, bool Dereference)
 Returns true if the container is const-qualified.


static const char clang::tidy::modernize::LoopNameArray [] = "forLoopArray"
static const char clang::tidy::modernize::LoopNameIterator [] = "forLoopIterator"
static const char clang::tidy::modernize::LoopNameReverseIterator [] = "forLoopReverseIterator"
static const char clang::tidy::modernize::LoopNamePseudoArray [] = "forLoopPseudoArray"
static const char clang::tidy::modernize::ConditionBoundName [] = "conditionBound"
static const char clang::tidy::modernize::InitVarName [] = "initVar"
static const char clang::tidy::modernize::BeginCallName [] = "beginCall"
static const char clang::tidy::modernize::EndCallName [] = "endCall"
static const char clang::tidy::modernize::EndVarName [] = "endVar"
static const char clang::tidy::modernize::DerefByValueResultName [] = "derefByValueResult"
static const char clang::tidy::modernize::DerefByRefResultName [] = "derefByRefResult"
static const llvm::StringSet clang::tidy::modernize::MemberNames
static const llvm::StringSet clang::tidy::modernize::ADLNames
static const llvm::StringSet clang::tidy::modernize::StdNames