#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
usingnamespaceclang::ast_matchers;
static const int MAXIMUM_STEP_UNROLLED = …;
namespace {
struct LoopState { … };
}
REGISTER_LIST_WITH_PROGRAMSTATE(…)
namespace clang {
namespace ento {
static bool isLoopStmt(const Stmt *S) { … }
ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State) { … }
static internal::Matcher<Stmt> simpleCondition(StringRef BindName,
StringRef RefName) { … }
static internal::Matcher<Stmt>
changeIntBoundNode(internal::Matcher<Decl> VarNodeMatcher) { … }
static internal::Matcher<Stmt>
callByRef(internal::Matcher<Decl> VarNodeMatcher) { … }
static internal::Matcher<Stmt>
assignedToRef(internal::Matcher<Decl> VarNodeMatcher) { … }
static internal::Matcher<Stmt>
getAddrTo(internal::Matcher<Decl> VarNodeMatcher) { … }
static internal::Matcher<Stmt> hasSuspiciousStmt(StringRef NodeName) { … }
static internal::Matcher<Stmt> forLoopMatcher() { … }
static bool isCapturedByReference(ExplodedNode *N, const DeclRefExpr *DR) { … }
static bool isFoundInStmt(const Stmt *S, const VarDecl *VD) { … }
static bool isPossiblyEscaped(ExplodedNode *N, const DeclRefExpr *DR) { … }
static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx,
ExplodedNode *Pred, unsigned &maxStep) { … }
static bool madeNewBranch(ExplodedNode *N, const Stmt *LoopStmt) { … }
ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx,
ExplodedNode *Pred, unsigned maxVisitOnPath) { … }
bool isUnrolledState(ProgramStateRef State) { … }
}
}