#include "InfiniteLoopCheck.h"
#include "../utils/Aliasing.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
#include "clang/Analysis/CallGraph.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/SmallVector.h"
usingnamespaceclang::ast_matchers;
hasPtrOrReferenceInFunc;
namespace clang {
namespace ast_matchers {
AST_MATCHER(Decl, declHasNoReturnAttr) { … }
AST_MATCHER(FunctionType, typeHasNoReturnAttr) { … }
}
namespace tidy::bugprone {
static internal::Matcher<Stmt>
loopEndingStmt(internal::Matcher<Stmt> Internal) { … }
static bool isChanged(const Stmt *LoopStmt, const VarDecl *Var,
ASTContext *Context) { … }
static bool isVarThatIsPossiblyChanged(const Decl *Func, const Stmt *LoopStmt,
const Stmt *Cond, ASTContext *Context) { … }
static bool isAtLeastOneCondVarChanged(const Decl *Func, const Stmt *LoopStmt,
const Stmt *Cond, ASTContext *Context) { … }
static std::string getCondVarNames(const Stmt *Cond) { … }
static bool isKnownToHaveValue(const Expr &Cond, const ASTContext &Ctx,
bool ExpectedValue) { … }
static bool populateCallees(const Stmt *StmtNode,
llvm::SmallSet<const Decl *, 16> &Callees) { … }
static bool overlap(ArrayRef<CallGraphNode *> SCC,
const llvm::SmallSet<const Decl *, 16> &Callees,
const Decl *Func) { … }
static bool hasStaticLocalVariable(const Stmt *Cond) { … }
static bool hasRecursionOverStaticLoopCondVariables(const Expr *Cond,
const Stmt *LoopStmt,
const Decl *Func,
const ASTContext *Ctx) { … }
void InfiniteLoopCheck::registerMatchers(MatchFinder *Finder) { … }
void InfiniteLoopCheck::check(const MatchFinder::MatchResult &Result) { … }
}
}