21 using namespace clang;
25 class UndefinedAssignmentChecker
27 mutable std::unique_ptr<BugType> BT;
35 void UndefinedAssignmentChecker::checkBind(
SVal location,
SVal val,
54 const char *str =
"Assigned value is garbage or undefined";
60 const Expr *ex =
nullptr;
64 if (B->isCompoundAssignmentOp()) {
67 str =
"The left expression of the compound assignment is an "
68 "uninitialized value. The computed value will also be garbage";
78 if (
const DeclStmt *DS = dyn_cast<DeclStmt>(StoreE)) {
86 auto R = llvm::make_unique<BugReport>(*BT, str, N);
88 R->addRange(ex->getSourceRange());
94 void ento::registerUndefinedAssignmentChecker(
CheckerManager &mgr) {
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
StringRef getCalleeName(const FunctionDecl *FunDecl) const
Get the name of the called function (path-sensitive).
ExplodedNode * generateErrorNode(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a transition to a node that will be used to report an error.
const Expr * getInit() const
VarDecl - An instance of this class is created to represent a variable declaration or definition...
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
A builtin binary operation expression such as "x + y" or "x <= y".
Expr - This represents one expression.
const ProgramStateRef & getState() const
void emitReport(std::unique_ptr< BugReport > R)
Emit the diagnostics report.
CHECKER * registerChecker()
Used to register checkers.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
const Decl * getDecl() const
const StackFrameContext * getStackFrame() const
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.
const LocationContext * getLocationContext() const