24 enum LoopType { UnknownLoop = -1, DoLoop = 0, WhileLoop = 1, ForLoop = 2 };
26 struct IdDependencyRecord {
27 IdDependencyRecord(
const VarDecl *Declaration, SourceLocation
Location,
28 const llvm::Twine &Message)
30 Message(Message.str()) {}
31 IdDependencyRecord(
const FieldDecl *Declaration, SourceLocation
Location,
32 const llvm::Twine &Message)
34 Message(Message.str()) {}
35 IdDependencyRecord() =
default;
36 const VarDecl *VariableDeclaration =
nullptr;
37 const FieldDecl *FieldDeclaration =
nullptr;
42 std::map<const VarDecl *, IdDependencyRecord> IdDepVarsMap;
44 std::map<const FieldDecl *, IdDependencyRecord> IdDepFieldsMap;
47 IdDependencyRecord *hasIdDepVar(
const Expr *Expression);
50 IdDependencyRecord *hasIdDepField(
const Expr *Expression);
53 void saveIdDepVar(
const Stmt *Statement,
const VarDecl *Variable);
56 void saveIdDepField(
const Stmt *Statement,
const FieldDecl *Field);
59 void saveIdDepVarFromReference(
const DeclRefExpr *RefExpr,
60 const MemberExpr *MemExpr,
61 const VarDecl *PotentialVar);
64 void saveIdDepFieldFromReference(
const DeclRefExpr *RefExpr,
65 const MemberExpr *MemExpr,
66 const FieldDecl *PotentialField);
68 LoopType getLoopType(
const Stmt *Loop);
74 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.