#include "clang/AST/CharUnits.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Checkers/Taint.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
usingnamespacetaint;
namespace {
class VLASizeChecker
: public Checker<check::PreStmt<DeclStmt>,
check::PreStmt<UnaryExprOrTypeTraitExpr>> { … };
}
ProgramStateRef VLASizeChecker::checkVLA(CheckerContext &C,
ProgramStateRef State,
const VariableArrayType *VLA,
SVal &ArraySize) const { … }
ProgramStateRef VLASizeChecker::checkVLAIndexSize(CheckerContext &C,
ProgramStateRef State,
const Expr *SizeE) const { … }
void VLASizeChecker::reportTaintBug(const Expr *SizeE, ProgramStateRef State,
CheckerContext &C, SVal TaintedSVal) const { … }
void VLASizeChecker::reportBug(VLASize_Kind Kind, const Expr *SizeE,
ProgramStateRef State, CheckerContext &C) const { … }
void VLASizeChecker::checkPreStmt(const DeclStmt *DS, CheckerContext &C) const { … }
void VLASizeChecker::checkPreStmt(const UnaryExprOrTypeTraitExpr *UETTE,
CheckerContext &C) const { … }
void ento::registerVLASizeChecker(CheckerManager &mgr) { … }
bool ento::shouldRegisterVLASizeChecker(const CheckerManager &mgr) { … }