22 using namespace clang;
26 class UndefinedArraySubscriptChecker
27 :
public Checker< check::PreStmt<ArraySubscriptExpr> > {
28 mutable std::unique_ptr<BugType> BT;
46 if (Ctor->isDefaulted())
53 BT.reset(
new BuiltinBug(
this,
"Array subscript is undefined"));
56 auto R = llvm::make_unique<BugReport>(*BT, BT->getName(), N);
62 void ento::registerUndefinedArraySubscriptChecker(
CheckerManager &mgr) {
ExplodedNode * generateErrorNode(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a transition to a node that will be used to report an error.
Decl - This represents one declaration (or definition), e.g.
Represents a C++ constructor within a class.
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
Expr - This represents one expression.
void emitReport(std::unique_ptr< BugReport > R)
Emit the diagnostics report.
CHECKER * registerChecker()
Used to register checkers.
Dataflow Directional Tag Classes.
const Decl * getDecl() const
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
bool trackNullOrUndefValue(const ExplodedNode *N, const Stmt *S, BugReport &R, bool IsArg=false, bool EnableNullFPSuppression=true)
Attempts to add visitors to trace a null or undefined value back to its point of origin, whether it is a symbol constrained to null or an explicit assignment.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
const LocationContext * getLocationContext() const