9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_LOOP_CONVERT_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_LOOP_CONVERT_H
12 #include "../ClangTidyCheck.h"
13 #include "../utils/IncludeInserter.h"
29 Preprocessor *ModuleExpanderPP)
override;
30 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
33 struct RangeDescriptor {
35 bool ContainerNeedsDereference;
38 std::string ContainerString;
40 bool NeedsReverseCall;
43 void getAliasRange(SourceManager &SM, SourceRange &DeclRange);
45 void doConversion(ASTContext *Context,
const VarDecl *IndexVar,
46 const ValueDecl *MaybeContainer,
const UsageResult &Usages,
47 const DeclStmt *AliasDecl,
bool AliasUseRequired,
48 bool AliasFromForInit,
const ForStmt *Loop,
49 RangeDescriptor Descriptor);
51 StringRef getContainerString(ASTContext *Context,
const ForStmt *Loop,
52 const Expr *ContainerExpr);
54 void getArrayLoopQualifiers(ASTContext *Context,
55 const ast_matchers::BoundNodes &Nodes,
56 const Expr *ContainerExpr,
58 RangeDescriptor &Descriptor);
60 void getIteratorLoopQualifiers(ASTContext *Context,
61 const ast_matchers::BoundNodes &Nodes,
62 RangeDescriptor &Descriptor);
64 void determineRangeDescriptor(ASTContext *Context,
65 const ast_matchers::BoundNodes &Nodes,
67 const Expr *ContainerExpr,
69 RangeDescriptor &Descriptor);
71 bool isConvertible(ASTContext *Context,
const ast_matchers::BoundNodes &Nodes,
74 StringRef getReverseFunction()
const;
75 StringRef getReverseHeader()
const;
77 std::unique_ptr<TUTrackingInfo> TUInfo;
78 const unsigned long long MaxCopySize;
82 bool UseReverseRanges;
83 const bool UseCxx20IfAvailable;
84 std::string ReverseFunction;
85 std::string ReverseHeader;
92 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_LOOP_CONVERT_H